/* Block Drop — scoped under .bd */
.bd { --side: 78px; display: grid; gap: 12px; justify-items: center; width: 100%; margin-inline: auto; }
/* the game sits in its own dark console in both themes */
.bd-main {
  --bd-ink: #EEF1FF; --bd-muted: #9BA3D6; --bd-card: rgba(255,255,255,.05); --bd-edge: rgba(150,165,255,.16);
  position: relative;
  display: flex; align-items: flex-start; justify-content: center; gap: 10px;
  padding: 10px; border-radius: 22px;
  background: radial-gradient(120% 80% at 50% 0%, #262C6E 0%, #171B48 55%, #10132F 100%);
  box-shadow: 0 0 0 1px rgba(120,135,255,.18), 0 18px 40px -18px rgba(16,19,60,.7);
  color: var(--bd-ink);
}
.bd-main > .k-overlay { inset: 0; border-radius: 22px; }

.bd-board {
  position: relative; flex: none;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1.5px rgba(140,160,255,.35), 0 0 22px rgba(90,110,255,.25), inset 0 0 0 1px rgba(0,0,0,.4);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.bd-board canvas { display: block; width: 100%; height: 100%; }

.bd-side { width: var(--side); display: grid; gap: 8px; align-content: start; }
.bd-box {
  display: grid; justify-items: center; gap: 4px;
  padding: 6px 4px 8px; border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--bd-edge);
  background: var(--bd-card); color: inherit; font: inherit;
}
.bd-box small { font-size: 0.6875rem; font-weight: 700; color: var(--bd-muted); letter-spacing: .04em; text-transform: uppercase; }
.bd-box canvas { display: block; }
button.bd-box { border: 0; cursor: pointer; touch-action: manipulation; }
button.bd-box:active { background: rgba(255,255,255,.1); }
button.bd-box:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.bd-stats { display: grid; gap: 6px; margin: 2px 0 0; }
.bd-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; padding: 0 2px; }
.bd-stats { padding: 8px 6px; border-radius: 12px; background: var(--bd-card); box-shadow: inset 0 0 0 1px var(--bd-edge); }
.bd-stats div { flex-direction: column; align-items: flex-start; gap: 0; }
.bd-stats dt { font-size: 0.625rem; font-weight: 700; color: var(--bd-muted); letter-spacing: .04em; text-transform: uppercase; }
.bd-stats dd { margin: 0; font-size: var(--t-md); font-weight: 760; font-variant-numeric: tabular-nums; color: var(--bd-ink); line-height: 1.2; }
.bd-stats [data-score] { color: #FFD45A; }
.bd-pause { width: 100%; padding: 0; min-height: 36px; background: var(--bd-card); color: var(--bd-ink); box-shadow: inset 0 0 0 1px var(--bd-edge); }
.bd-pause:hover { background: rgba(255,255,255,.1); }

.bd-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; max-width: 380px; }
.bd-pad button {
  display: grid; place-items: center; height: 54px;
  border: 0; border-radius: var(--r-md);
  background: linear-gradient(#232A6A, #191E52); color: #EEF1FF; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(120,135,255,.2), 0 4px 10px -4px rgba(16,19,60,.6);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, background-color .12s;
}
.bd-pad button:active { transform: scale(.94); filter: brightness(1.25); }
.bd-pad button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bd-pad [data-key="hard"] { background: linear-gradient(#FF6470, #E5484D); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 12px -4px rgba(229,72,77,.6); }
.bd-pad [data-key="hard"]:active { background: var(--c); filter: brightness(.92); }

.bd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 359px) {
  .bd-pad { gap: 6px; }
  .bd-pad button { height: 50px; }
}

/* keyboard hint (desktop only) */
.bd-keys { display: none; color: var(--muted); font-size: var(--t-xs); text-align: center; }
.bd--keys .bd-keys { display: block; }
.bd--keys .bd-pad { display: none; }

/* phone held upright: hold / next / score in a strip above the board */
.bd--top { gap: 8px; }
.bd--top .bd-main { flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 6px; border-radius: 18px; }
.bd--top .bd-main > .k-overlay { border-radius: 18px; }
.bd--top .bd-board { border-radius: 10px; }
.bd--top .bd-side { order: -1; width: 100%; display: flex; gap: 6px; align-items: stretch; }
.bd--top .bd-box { padding: 4px 6px 5px; gap: 2px; flex: none; }
.bd--top .bd-box small { font-size: 0.5625rem; }
.bd--top .bd-stats { flex: 1; min-width: 0; margin: 0; padding: 5px 8px; grid-template-columns: 1fr 1fr; gap: 0 8px; align-content: center; }
.bd--top .bd-stats div:nth-child(2) { display: none; }
.bd--top .bd-stats div:first-child { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; }
.bd--top .bd-stats div:first-child dd { font-size: var(--t-lg); }
.bd--top .bd-stats div { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 6px; }
.bd--top .bd-stats dd { font-size: var(--t-sm); }
.bd--top .bd-pause { width: 40px; min-height: 0; flex: none; }
.bd--top .bd-pad { max-width: none; }

/* phone held sideways: move buttons on the left, turn and drop on the right */
.bd--land { grid-template-columns: 64px auto 64px; grid-template-rows: repeat(3, auto); grid-template-areas: "l1 main r1" "l2 main r2" ". main r3"; column-gap: 14px; row-gap: 10px; align-content: center; justify-content: center; }
.bd--land .bd-main { grid-area: main; }
.bd--land .bd-pad { display: contents; }
.bd--land .bd-pad button { width: 64px; height: 64px; }
.bd--land [data-key="left"] { grid-area: l1; align-self: end; }
.bd--land [data-key="right"] { grid-area: l2; align-self: start; }
.bd--land [data-key="rot"] { grid-area: r1; align-self: end; }
.bd--land [data-key="soft"] { grid-area: r2; }
.bd--land [data-key="hard"] { grid-area: r3; align-self: start; }
.bd--land .bd-keys { display: none; }

/* tablet and desktop: a little more room for the panel */
.bd--side .bd-pad { max-width: calc(var(--boardw) + var(--side) + 30px); }

.bd--land .bd-side { grid-template-columns: 1fr 1fr; grid-template-areas: "hold stats" "next stats" "next pause"; align-content: start; }
.bd--land .bd-hold { grid-area: hold; }
.bd--land .bd-side > .bd-box:not(.bd-hold) { grid-area: next; align-self: start; }
.bd--land .bd-stats { grid-area: stats; margin: 0; }
.bd--land .bd-pause { grid-area: pause; align-self: start; }
