html, body {
  overscroll-behavior: none;
}

body.game-focus {
  overflow: hidden;
}

body.game-focus .topbar,
body.game-focus .bottom-nav {
  display: none;
}

body.game-focus .app-shell {
  min-height: 100dvh;
  padding-bottom: 0;
}

body.game-focus .page.active {
  padding: 0 12px;
  min-height: 100dvh;
}

.game-mount.focused-game {
  height: 100dvh;
  width: 100%;
}

.game-mount.focused-game .game-shell {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.game-header {
  width: min(calc(100vw - 24px), calc(100dvh - 250px), 560px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 40px;
}

.game-title {
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: var(--muted);
}

.game-header .timer {
  justify-self: end;
}

.back-button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 9px 4px;
  font-weight: 800;
}

.game-mount.focused-game .board {
  width: min(calc(100vw - 24px), calc(100dvh - 250px), 560px);
  flex: 0 0 auto;
  box-shadow: 0 8px 24px rgba(43, 41, 35, .06);
}

.game-mount.focused-game .number-pad,
.game-mount.focused-game .tool-row,
.game-mount.focused-game .finish-button,
.focused-race {
  width: min(calc(100vw - 24px), calc(100dvh - 250px), 560px);
  margin-left: auto;
  margin-right: auto;
}

.game-mount.focused-game .number-pad {
  margin-top: 2px;
}

.game-mount.focused-game .tool-row {
  margin-top: 0;
}

.finish-button {
  min-height: 42px;
  margin-top: 0;
}

.cell.peer,
.cell.same-number,
.cell.wrong {
  background: #fff;
  color: var(--blue);
}

.cell.given.peer,
.cell.given.same-number,
.cell.given.wrong {
  background: #fbfaf6;
  color: var(--ink);
}

.cell.selected,
.cell.given.selected {
  background: #e2e7dc;
}

.cell.hinted {
  color: var(--blue);
}

.number-pad button {
  min-height: 40px;
  opacity: 1 !important;
  visibility: visible !important;
}

.center {
  text-align: center;
}

.result-card {
  text-align: center;
  margin-top: 14px;
}

.stat-box.wide {
  grid-column: 1 / -1;
}

.stats-list {
  margin-top: 12px;
}

.stats-list > div {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.bottom-nav .nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

body.game-focus .toast {
  bottom: calc(18px + env(safe-area-inset-bottom));
}

.waiting-panel h3 {
  margin-bottom: 6px;
}

.racer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.racer-label strong {
  margin: 0;
}

.racer-label span {
  font-size: 15px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.progress.large {
  height: 9px;
  margin: 0 0 8px;
}

.focused-race {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.focus-racer {
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.focus-racer > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 5px;
}

.focus-racer strong {
  font-size: 11px;
}

.focus-racer span {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.focus-racer .progress {
  margin: 0;
  height: 5px;
}

.spectate-shell {
  min-height: 100dvh;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 0 max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.spectate-shell .game-header {
  width: 100%;
}

.spectate-card {
  padding: 26px 20px;
}

.spectate-card h2 {
  font-size: 54px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.spectate-progress {
  height: 12px;
  margin: 0 0 14px;
}

.reaction-panel {
  padding: 8px 0;
}

.reaction-panel p {
  margin-bottom: 8px;
}

.reaction-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.reaction-row button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  min-height: 50px;
  font-size: 24px;
  transition: transform .12s ease;
}

.reaction-row button.sent {
  transform: scale(.86);
}

.reaction-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.reaction-bubble {
  min-width: 130px;
  min-height: 130px;
  padding: 18px;
  border-radius: 34px;
  background: rgba(255,253,248,.96);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(31,33,29,.18);
  display: grid;
  place-items: center;
  align-content: center;
  animation: reaction-pop .18s ease-out;
}

.reaction-bubble span {
  font-size: 60px;
  line-height: 1;
}

.reaction-bubble small {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

@keyframes reaction-pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-height: 700px) {
  .game-mount.focused-game .game-shell {
    gap: 4px;
  }
  .game-mount.focused-game .board,
  .game-header,
  .game-mount.focused-game .number-pad,
  .game-mount.focused-game .tool-row,
  .game-mount.focused-game .finish-button,
  .focused-race {
    width: min(calc(100vw - 24px), calc(100dvh - 230px), 520px);
  }
  .number-pad button,
  .tool-row button,
  .finish-button {
    min-height: 34px;
  }
}
