/* Pebble Crush — the board, the strip beside it, and nothing else.

   Everything that is not specific to this game — the bars, the buttons, the
   readout, the stage, the dialogs — is in css/games/arcade.css, which every
   arcade game loads. If a rule in here would also be right for Bubble Pop, it
   is in the wrong file. */

/* Three things on this page are hidden by the `hidden` attribute rather than
   by a class: the pebble picker until there is more than one set, and the two
   readout items that only mean something in a game with a move limit.

   A bare [hidden] selector is one attribute against .ar-field and
   .ar-readout__item, and those set `display` — so the class wins and the
   hidden thing stays on screen. This is the one rule that settles it, scoped
   to this page so nothing else on the site changes. */
.pebbles-page [hidden] { display: none !important; }

/* The board and the strip beside it.

   The board is square — eight by eight — so a wide window leaves room going
   spare at the sides. That is where the strip goes, rather than into a bigger
   board: a match-three board with more cells on it is not a better game, it is
   a smaller target for every finger playing it. On a narrow window the strip
   drops underneath. */
.pb-play {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.pb-stage { flex: 1; min-width: 0; }

.pb-side {
  flex: 0 0 13rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  overflow-y: auto;
}

.pb-side__title {
  margin: 10px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pb-side__title:first-child { margin-top: 0; }

.pb-side__goal {
  margin: 2px 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--accent);
  font-weight: 600;
}

/* Made this, get that. Two columns so the eye can run down either side of it
   without reading the whole thing. */
.pb-side__specials {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 4px 0 0;
  font-size: 0.86rem;
}

.pb-side__specials dt {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.pb-side__specials dd {
  margin: 0;
  color: var(--ink-muted);
}

.pb-side__hint {
  margin: 14px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

/* The stars in the readout sit on the number rather than under it. */
.pebbles-page .ar-readout__note {
  margin-left: 6px;
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--warn);
}

/* Under the board rather than beside it. 52rem is where the board plus a 13rem
   strip stops leaving the board a sensible size. */
@media (max-width: 52rem) {
  .pb-play { flex-direction: column; }

  /* Over the board rather than under it: under, it would sit below the dock,
     and the dock belongs at the bottom where a thumb is. */
  .pb-side { order: -1; }

  .pb-side {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
  }

  .pb-side__title { margin: 0; }

  /* On a phone the paragraph is the first thing to go: the rules are in How
     to play, which is one tap away and always current. */
  .pb-side__hint { display: none; }
  .pb-side__specials { display: none; }
}

/* A short window gives the board everything it can. */
@media (max-height: 560px) {
  .pb-side { padding: 6px 8px; }
  .pb-side__hint { display: none; }
}

#pace-slider {
  width: 9rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.pb-pace {
  min-width: 2.6rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

/* The door's colours question: all three on one row. At the shared 6.5rem
   they wrapped two and one, and that extra row pushed the door's buttons
   below the fold on a 768-high laptop. Here, not in screens.css -- the card
   games use the same row for their own question. */
.pebbles-page .ar-way {
  flex-basis: 5rem;
  padding: 7px 6px;
  text-align: center;
}

/* Which board this is, over its goal. Quieter than the goal: it is a label,
   and the number in it is there to be copied, not read aloud. */
.pb-side__board {
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* The last thirty seconds of the ten-minute clock. main.js adds .is-low. */
#timer-item.is-low b { color: var(--danger); }

/* A timed board goes out of sight behind a dialog, or behind the front door
   when Menu is pressed. The clock stops for both, so a board left in view
   would make either one a free pause for hunting the next swap. main.js puts
   .pb-timed on the shell only while a timed board is being played. */
.pb-timed:has(dialog[open]) #table,
.pb-timed:has(.ar-screen:not([hidden])) #table {
  filter: blur(14px);
}

/* The rules in How to play: a little board for every line, every odd pebble
   and every pair of them, beside what it does. The pictures are canvases
   drawn by js/games/pebbles/pictures.js at a fixed size, so the words take
   whatever room is left and wrap there. */
.pb-rules { margin: 0 0 6px; }

.pb-rule {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
}

.pb-rule canvas {
  display: block;
  border-radius: 6px;
}

.pb-rule b {
  display: block;
  color: var(--ink);
}

.pb-rule span { color: var(--ink-muted); }

.pb-rules__note {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
}

/* Handheld mode on a phone (css/games/handheld.css): the numbers are one line
   of four. Coins are on the first screen and on the tally, where they are
   news; on the line over the board they were the fifth number and the one
   that wrapped it onto two. */
@media (pointer: coarse) and (max-width: 720px) {
  .hh-app .pb-coins { display: none; }
  .pebbles-page .hh-app .ar-readout__note { margin-left: 0; font-size: 0.72rem; }
}
