body.blox-page {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.blox-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.blox-stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(132px, 180px) minmax(220px, auto) minmax(132px, 200px);
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 12px;
  min-height: 0;
}

.side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: rgba(15, 22, 38, 0.85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.panel-label {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.stat-row + .stat-row { margin-top: 6px; }
.stat-row strong {
  font-family: var(--mono);
  color: var(--paper);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#hold-box.is-locked { opacity: 0.45; }
#hold-canvas, #next-canvas { display: block; width: 100%; height: auto; }
#hold-canvas { height: 80px; }
#next-canvas { height: 320px; }

.well-frame {
  display: flex;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-items: center;
}
.well-wrap {
  --chrome: 168px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, calc(min(calc(100dvh - var(--chrome)), 720px) * 0.5));
  aspect-ratio: 10 / 20;
  height: auto;
  max-width: 100%;
  background: #05080f;
  border-radius: 8px;
  box-shadow:
    0 0 0 3px #1a2438,
    0 0 0 8px #0e1524,
    0 18px 50px rgba(0, 0, 0, 0.45),
    inset 0 0 40px rgba(80, 140, 255, 0.05);
  overflow: hidden;
}
#well {
  display: block;
  margin: 0 auto;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 16, 0.72);
  text-align: center;
  padding: 12px;
  overflow: auto;
}
.overlay.is-on { display: flex; }
.overlay-card h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 6vw, 48px);
  letter-spacing: 0.08em;
}
.overlay-card p { margin: 0 0 16px; color: var(--muted); }
.overlay-card .play-btn { font-size: 16px; padding: 12px 22px; }
.level-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0 16px; }
.level-chip {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-family: var(--mono);
  cursor: pointer;
}
.level-chip.is-active { background: var(--gold); color: #1a1408; border-color: var(--gold); }

#toast {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
  font-size: clamp(16px, 3vw, 22px);
  color: var(--gold-2);
}
#toast.is-tetris {
  color: #fff;
  font-size: clamp(22px, 4vw, 32px);
}

.icon-row { display: flex; gap: 8px; }
.icon-btn {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #121a2c;
  color: var(--paper);
  cursor: pointer;
  font-family: inherit;
  font-weight: 650;
}
.icon-btn.is-off { opacity: 0.5; }

.help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}
.help-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(243, 234, 212, 0.06);
}
.help-list kbd {
  font-family: var(--mono);
  color: var(--paper);
  background: #0b1020;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 11px;
}

.how p { margin: 0; font-size: 13px; color: var(--muted); }

.touch-pad {
  display: none;
  padding: 8px 12px 16px;
  gap: 8px;
  grid-template-columns: repeat(4, 1fr);
}
.pad-btn {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #151c2e;
  color: var(--paper);
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  touch-action: manipulation;
  user-select: none;
}
.pad-btn.is-down, .pad-btn:active { background: #2a3758; }
.pad-hard { grid-column: span 2; background: var(--gold); color: #1a1408; }

.over-score { font-family: var(--mono); font-size: 28px; color: var(--gold); margin: 0 0 4px !important; }
.best-flag {
  display: inline-block;
  background: var(--gold);
  color: #1a1408;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

@media (pointer: coarse), (max-width: 820px) {
  .touch-pad { display: grid; }
  .blox-stage { padding-bottom: 4px; }
  .well-wrap { --chrome: 250px; }
  .help-panel, .how { display: none; }
  #next-canvas { height: 220px; }
}

@media (max-width: 700px) {
  .jeux-nav .home span { display: none; }
  .blox-stage {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 8px;
    padding: 8px 8px 4px;
  }
  .panel { padding: 8px; border-radius: 10px; }
  .stat-row strong { font-size: 13px; }
  .panel-label { font-size: 9px; margin-bottom: 4px; }
  #hold-canvas { height: 52px; }
  #next-canvas { height: 180px; }
  .icon-btn { height: 34px; font-size: 12px; }
  .well-wrap {
    --chrome: 236px;
    box-shadow: 0 0 0 2px #1a2438, 0 0 0 5px #0e1524;
  }
}

@media (max-height: 700px) and (max-width: 700px) {
  .well-wrap { --chrome: 210px; }
  .touch-pad { padding-bottom: 8px; }
  .pad-btn { height: 42px; }
}
