* { box-sizing: border-box; }
body { margin: 0; padding: 58px 0 42px; font-family: Arial, sans-serif; background: #f7f7f2; color: #222; }
#background-video { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover; z-index: -1; pointer-events: none; }
main {
  max-width: 440px;
  margin: 0 auto;
  padding: 6px 18px 18px;
  text-align: center;
}
h1 { font-size: 1.35rem; margin: 10px 0 8px; }
p { min-height: 22px; margin: 0 0 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.back { color: #333; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.timer { min-width: 52px; font-variant-numeric: tabular-nums; font-weight: bold; text-align: right; }
.info-button { min-height: 34px; margin: 0; padding: 6px 10px; }
.puzzle { display: grid; grid-template-columns: 64px repeat(var(--cols), 1fr); gap: 4px; align-items: stretch; }
.clue { min-height: 44px; display: grid; place-items: center; padding: 2px; font-weight: bold; font-size: calc(.82rem + 4px); text-shadow: 0 1px 3px rgba(255,255,255,.85); }
.puzzle > .clue:not(.top) { justify-items: end; text-align: right; padding-right: 8px; }
.top { align-items: end; white-space: pre-line; line-height: 1.05; }
.cell { aspect-ratio: 1; border: 1px solid #777; border-radius: 4px; background: #fff; font-weight: bold; }
.filled { background: #333; color: #fff; }
.x { color: #777; background: #eee; }
.answer { background: #bfe7c2; color: #111; }
.wrong { background-image: linear-gradient(135deg, transparent 44%, #c62828 46%, #c62828 54%, transparent 56%); }
.actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions button,
.picker button,
dialog button {
  min-height: 40px;
  padding: 8px 12px;
  margin-top: 0;
  border: 1px solid #777;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
}
.actions .active { background: #333; color: #fff; }
.size-picker, .picker { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.size-picker { margin: 0; }
.picker button { min-width: 42px; }
.size-picker button {
  min-height: 40px;
  min-width: 64px;
  padding: 8px 12px;
  margin-top: 0;
  border: 1px solid #777;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
}
.picker .active, .size-picker .active { background: #333; color: #fff; }
.gameContextGroup .size-picker { justify-content: flex-start; gap: 6px; }
.gameContextGroup .size-picker button { min-height: 30px; min-width: 54px; padding: 4px 8px; margin: 0; font-size: .85rem; }
.gameContextGroup .info-button { min-height: 30px; margin: 0; padding: 4px 10px; font-size: .85rem; }
dialog { border: 1px solid #555; border-radius: 8px; text-align: center; max-width: 300px; }
.puzzle-modal-row { display: grid; gap: 10px; margin: 12px 0 16px; }
.puzzle-modal-row span { font-weight: 700; }
.puzzle-modal .picker { margin: 0; }
.info-modal h2 { margin: 0 0 8px; font-size: 1.1rem; }
.info-modal p { line-height: 1.4; }
