/* ブロックフォール（落ちものパズル）の画面 */
.bf-page { --side-col: 128px; }
.bf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.bf-head .sub { margin: 0; }
.bf-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bf-tools { display: flex; gap: 6px; }
.bf-tools .btn { padding: 7px 11px; }

.bf-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bf-wrap > * { min-width: 0; }
.bf-play {
  display: grid; grid-template-columns: var(--side-col) auto var(--side-col); justify-content: center; gap: 14px;
  padding: 18px; background: #0d1626; border-color: #1c2a42; color: #e8eef8;
  background-image: radial-gradient(600px 300px at 50% -10%, rgba(57,135,229,.22), transparent 70%);
}
.bf-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bf-box { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 8px 8px 10px; }
.bf-lbl { font-family: Manrope, sans-serif; font-weight: 800; font-size: 11px; letter-spacing: .22em; color: #8ea6c8; margin: 0 0 6px 2px; }
.bf-box canvas { display: block; margin: 0 auto; }
.bf-stats { display: grid; gap: 8px; }
.bf-stat { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 6px 10px; }
.bf-stat span { display: block; font-size: 10.5px; color: #8ea6c8; letter-spacing: .06em; }
.bf-stat b { display: block; font-family: Manrope, sans-serif; font-weight: 800; font-size: 19px; line-height: 1.25; font-variant-numeric: tabular-nums; }

.bf-board { position: relative; border-radius: 6px; box-shadow: 0 0 0 2px #2a3d5e, 0 18px 40px -18px rgba(0,0,0,.8); }
.bf-board canvas { display: block; border-radius: 6px; }

/* 消したときの表示 */
.bf-action { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; opacity: 0; }
.bf-action.show { animation: bfPop 1.6s ease-out forwards; }
.bf-action .a1 { font-family: Manrope, sans-serif; font-weight: 800; font-size: 22px; letter-spacing: .06em; color: #fff; text-shadow: 0 2px 12px rgba(26,99,214,.9); }
.bf-action .a2 { font-family: Manrope, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .12em; color: #ffd86b; }
.bf-action .a3 { font-family: Manrope, sans-serif; font-weight: 800; font-size: 15px; color: #9fd2ff; }
@keyframes bfPop { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* スタート・一時停止・結果 */
.bf-ov {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; border-radius: 6px;
  background: rgba(8,14,26,.78); backdrop-filter: blur(2px);
}
.bf-ov[hidden] { display: none; }
.bf-ov h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: .04em; color: #fff; }
.bf-ov p { margin: 0 0 14px; color: #b9c7dc; font-size: 13px; line-height: 1.6; }
.bf-ov .big { font-family: Manrope, sans-serif; font-weight: 800; font-size: 34px; color: #fff; line-height: 1.2; }
.bf-ov .count { font-family: Manrope, sans-serif; font-weight: 800; font-size: 40px; letter-spacing: .1em; color: #fff; }
.bf-ov .btns { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.bf-ov .btn { min-width: 150px; }
.bf-ov .btn:not(.primary) { background: transparent; color: #e8eef8; border-color: rgba(255,255,255,.25); }
.bf-ov .new { display: inline-block; margin: 4px 0 10px; padding: 2px 12px; border-radius: 99px; background: #ffd86b; color: #3a2a00; font-weight: 800; font-size: 13px; }
.bf-ov .res { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 6px auto 14px; font-size: 13px; color: #b9c7dc; text-align: left; }
.bf-ov .res b { color: #fff; font-family: Manrope, sans-serif; text-align: right; }
.bf-ov kbd { font-family: Manrope, sans-serif; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(255,255,255,.3); }

/* 右側のカード */
.bf-side { display: grid; gap: 14px; }
.bf-side .card { padding: 14px 16px; }
.bf-side h3 { margin: 0 0 8px; font-size: 14px; }
.bf-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; align-items: center; margin: 0; }
.bf-keys dt { white-space: nowrap; }
.bf-keys dd { margin: 0; color: var(--muted); }
.bf-keys kbd, .bf-help kbd {
  display: inline-block; min-width: 24px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px;
  background: var(--surface-2); font-family: Manrope, "Hiragino Sans", sans-serif; font-size: 12px; font-weight: 700; text-align: center; line-height: 1.6;
}
.bf-best { width: 100%; border-collapse: collapse; font-size: 13px; }
.bf-best td { padding: 5px 2px; border-top: 1px solid var(--line); }
.bf-best tr:first-child td { border-top: 0; }
.bf-best .rk { width: 24px; font-family: Manrope, sans-serif; font-weight: 800; color: var(--muted); }
.bf-best tr:first-child .rk { color: #d49a00; }
.bf-best .v { font-family: Manrope, "Hiragino Sans", sans-serif; font-weight: 800; }
.bf-best .d { text-align: right; color: var(--muted); font-size: 11.5px; }
.bf-help { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0; padding-left: 1.1em; }

/* スマホ用のボタン */
.bf-pad { display: none; }
.bf-pad button {
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; padding: 0; cursor: pointer;
}
.bf-pad button.on { background: var(--brand-soft); border-color: var(--brand); }
.bf-pad svg { width: 24px; height: 24px; }
.bf-pad .hard { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 設定 */
.bf-dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.bf-dialog::backdrop { background: rgba(8,14,26,.55); }
.bf-dialog form { padding: 20px; display: grid; gap: 14px; }
.bf-dialog h3 { margin: 0; font-size: 17px; }
.bf-field { display: grid; gap: 4px; font-size: 14px; }
.bf-field .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bf-field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.bf-field output { font-family: Manrope, sans-serif; font-weight: 800; }
.bf-field input[type=range] { width: 100%; accent-color: var(--brand); }
.bf-field select { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.bf-check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.bf-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.bf-dialog .foot { display: flex; justify-content: space-between; gap: 8px; }

@media (max-width: 1180px) {
  .bf-wrap { grid-template-columns: minmax(0, 1fr); }
  .bf-side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* スマホ：左右の列を細くして、下に操作ボタン */
@media (max-width: 899px), (pointer: coarse) {
  .bf-pad {
    display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 54px 54px; gap: 8px; margin-top: 10px;
    grid-template-areas: "hold ccw cw hard" "left soft right hard";
  }
  .bf-pad [data-act=left] { grid-area: left; } .bf-pad [data-act=right] { grid-area: right; }
  .bf-pad [data-act=soft] { grid-area: soft; } .bf-pad [data-act=hard] { grid-area: hard; }
  .bf-pad [data-act=ccw] { grid-area: ccw; } .bf-pad [data-act=cw] { grid-area: cw; }
  .bf-pad [data-act=hold] { grid-area: hold; }
  .bf-keys-card { display: none; }
}
@media (max-width: 899px) {
  .bf-page { --side-col: 62px; }
  .bf-head { margin-bottom: 8px; align-items: center; }
  .bf-head .sub, .bf-head h1 { display: none; }
  .bf-head > div:first-child { width: 100%; }
  .bf-head-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; gap: 8px; }
  .bf-head-right .chips { min-width: 0; flex: 1; }
  .bf-head-right .chip { padding: 5px 11px; font-size: 12.5px; }
  .bf-head { position: relative; }
  .bf-head .back { line-height: 34px; }
  .bf-tools { position: absolute; top: 0; right: 0; }
  .bf-tools .btn { padding: 0; width: 36px; height: 34px; }
  .bf-ov .hint { display: none; }
  .bf-play { padding: 8px; gap: 8px; border-radius: 14px; }
  .bf-col { gap: 8px; }
  .bf-box { padding: 5px 4px 6px; border-radius: 9px; }
  .bf-lbl { font-size: 9px; letter-spacing: .12em; margin-bottom: 3px; text-align: center; }
  .bf-stat { padding: 4px 5px; border-radius: 8px; }
  .bf-stat span { font-size: 9px; letter-spacing: 0; }
  .bf-stat b { font-size: 13px; }
  .bf-action .a1 { font-size: 17px; }
  .bf-side { margin-top: 4px; }
}
