/* ════════════════════════════════════════════════════════════════════════
   MINI GAMES (js/minigames.js)
   Old-web plain: a plain white rounded box, no border or shadow
   (the same for every game), no animations, no focus rings. Lines and words in the
   stickers' dark blue, pixel font. Literal colours on purpose: the box
   stays white in Pink Night too. The box is always the same size: the
   foot under the board is there (empty) until the game ends.
   ════════════════════════════════════════════════════════════════════════ */

.tomo-minigame {
  --mg-ink: #130036;
  --mg-px: 5px;                       /* one font pixel; js sets it per game */
  position: fixed; inset: 0; z-index: 99980;   /* above nav, buddy, confetti; under the intro splash */
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(19, 0, 54, 0.3);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;                 /* phones: no scrolling the page behind, no double-tap zoom */
  overscroll-behavior: contain;
}
.tomo-minigame[hidden] { display: none; }
html.tomo-mg-on { overflow: hidden; }

.tomo-mg-window {
  position: relative;
  /* The box is (width + 120px) tall, so on short screens (phones on their
     side) it shrinks to fit the height too, keeping the × reachable. */
  width: min(360px, 100%);
  width: min(360px, 100%, calc(100vh - 152px));
  width: min(360px, 100%, calc(100dvh - 152px));
  padding: 48px 24px 0;
  box-sizing: border-box;
  background: #fff;
  border-radius: 22px;                         /* every mini game: the same white rounded box */
}

/* Everything in here: no rings, no tap flashes, no transitions */
.tomo-minigame *, .tomo-minigame *::before, .tomo-minigame *::after {
  animation: none !important; transition: none !important;
}
.tomo-minigame button {
  font: inherit; color: inherit;
  outline: none !important; box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* × made of two plain lines */
.tomo-mg-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 0; background: none; cursor: pointer;
}
.tomo-mg-close::before,
.tomo-mg-close::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 20px; height: 3px; margin: -1.5px 0 0 -10px;
  background: var(--mg-ink);
  transform: rotate(45deg);
}
.tomo-mg-close::after { transform: rotate(-45deg); }

.tomo-mg-sticker {
  display: block; max-width: none; flex: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}

/* ── Pick a tomo: "choose!" and the two, on a block grid like the boards ── */
.tomo-mg-pick-btn { z-index: 1; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; }
.tomo-mg-pick-btn > * { position: absolute; }
/* The box round a tomo you can pick, and the see-through keyboard preview */
.tomo-mg-box { left: 0; top: 0; pointer-events: none; }
.tomo-mg-sticker.is-ghost { opacity: 0.5; }

/* ── Boards: everything placed on the block grid by js (left/top in px) ── */
.tomo-mg-stage { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.tomo-mg-board { position: relative; flex: none; }
.tomo-mg-board.is-clipped { overflow: hidden; }   /* tomos walking in from off the edge */
.tomo-mg-at, .tomo-mg-line, .tomo-mg-cell, .tomo-mg-col { position: absolute; }
.tomo-mg-pix { display: block; image-rendering: pixelated; }
.tomo-mg-line { z-index: 0; background: var(--mg-ink); }

.tomo-mg-cell, .tomo-mg-col, .tomo-mg-angel {
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer;
}
.tomo-mg-cell:disabled, .tomo-mg-col:disabled { cursor: default; }
.tomo-mg-cell.is-dim, .tomo-mg-sticker.is-dim, .tomo-mg-angel.is-dim { opacity: 0.2; }
.tomo-mg-angel > * { position: absolute; }

/* Higher or lower: the title words and the card's number, pixel font on the block grid */
.tomo-mg-num {
  z-index: 1;
  font-family: 'Press Start 2P', monospace; color: var(--mg-ink);
  white-space: nowrap;
  -webkit-font-smoothing: none; font-smooth: never;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}

/* ── Foot: empty while playing, then the only words ──────────────────── */
/* --mg-px (set by js) = one font pixel = one tomo pixel of the game being
   played (exactly two in Connect 4, where they're small). The font is
   drawn on an 8 × 8 grid with its spare column on the right, so one
   pixel of padding on the left centres the letters. */
.tomo-mg-foot {
  height: 120px; padding-bottom: 6px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--mg-px);
  font-family: 'Press Start 2P', monospace; color: var(--mg-ink);
  font-size: calc(var(--mg-px) * 8); line-height: 1; white-space: nowrap;
  -webkit-font-smoothing: none; font-smooth: never;
}
.tomo-mg-word { margin: 0; padding-left: var(--mg-px); font-size: inherit; line-height: 1; font-weight: 400; }
.tomo-mg-again {
  padding: var(--mg-px);                    /* always there: nothing moves on hover */
  border: 0; border-radius: 0; background: none; cursor: pointer;
  font-family: 'Press Start 2P', monospace !important; font-size: inherit !important; line-height: 1; font-weight: 400;
  color: var(--mg-ink) !important;
}
.tomo-mg-again .is-on, .tomo-mg-again:hover .is-off { display: none; }
.tomo-mg-again:hover .is-on { display: block; }
/* Hover: a solid box one pixel round the arrow, arrow inverted to white */
.tomo-mg-again:hover { background: var(--mg-ink) !important; color: #fff !important; }

/* ── Wide games (pairs): js sizes the window to the board (wideBlock), so
   it fits a phone on its side; the foot is one short row (word, then the
   arrow beside it) ─────────────────────────────────────────────────── */
.tomo-minigame.is-wide { padding: 8px; }                        /* slimmer gaps: bigger cards on phones */
.tomo-mg-window.is-wide { max-width: 100%; padding-left: 12px; padding-right: 12px; }
.tomo-mg-window.is-wide .tomo-mg-stage { aspect-ratio: auto; }
.tomo-mg-window.is-wide .tomo-mg-foot {
  height: calc(var(--mg-px) * 16); padding-bottom: 0;
  flex-direction: row; justify-content: center; align-items: center; gap: calc(var(--mg-px) * 4);
}
/* ── Draw: the picture (a 48 × 48 canvas scaled up in whole blocks) ──── */
.tomo-mg-draw { z-index: 1; cursor: crosshair; touch-action: none; }

.tomo-mg-card { z-index: 1; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; }
.tomo-mg-card > * { position: absolute; left: 0; top: 0; }

/* ── Coupon card (an advent door's coupon): the same box without the foot;
   blob, code and words stacked in the middle ───────────────────────── */
.tomo-mg-window.is-card { padding-bottom: 48px; }
.tomo-mg-window.is-card .tomo-mg-foot { display: none; }
.tomo-mg-coupon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.tomo-mg-coupon-code { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-transform: uppercase; }
.tomo-mg-coupon-text { max-width: 100%; white-space: normal; overflow-wrap: break-word; }

/* Product card: the picture (a product photo, so not hard pixels), the
   name on two lines at most, and the boxed link (js sizes it in blocks) */
.tomo-mg-product-img { display: block; flex: none; object-fit: contain; }
.tomo-mg-product-name { overflow: hidden; flex: none; }
.tomo-mg-go {
  flex: none; display: block; border: 0 solid var(--mg-ink);
  font-family: 'Press Start 2P', monospace; font-weight: 400; text-decoration: none !important;
  color: var(--mg-ink) !important; background: #fff;
  -webkit-font-smoothing: none; font-smooth: never;
  outline: none !important; -webkit-tap-highlight-color: transparent;
}
.tomo-mg-go:hover { background: var(--mg-ink); color: #fff !important; }
