/* ================================================================
   The activity's own chrome.

   Everything a *game* draws comes from theme.css, ui.css and shell.css — this sheet
   adds only what this surface has that the client it borrows from does not: a top bar
   with a wallet in it, a lobby of games, a bet log, and the handful of boards whose
   shape differs here (a 25-tile keno, a three-colour ring, a 3×3 slot board).

   There is no channel list and no message river, so none of that is styled: this is a
   grid of games and the game you opened, and nothing else.
   ================================================================ */

/* ---------------------------------------------------------------- the surface

   The activity sits inside the client, so its surface is the client's channel grey
   (#313338) rather than the shell's own. One override, because every screen — lobby,
   game, boot, blocked — and the top bar all paint with --sh-main. */
:root { --sh-main: #313338; }
html, body.chat_app { background: var(--sh-main); }

/* ---------------------------------------------------------------- the top bar */

.dd_top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--sh-head-h);
  padding: 0 16px;
  background: var(--sh-main);
  border-bottom: 1px solid var(--sh-line);
  z-index: 5;
}

/* The game's name while one is open, the product's while none is. One label, because
   the surface only ever shows one thing at a time. */
.dd_brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--sh-head);
  letter-spacing: .01em;
}

/* The invite, read as one word: the host in the client's muted grey, the name in the
   head colour, the diamond after it as the mark. */
.dd_invite {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
}
.dd_invite_gg { color: #80848e; }
.dd_invite_name { color: #f2f3f5; }
.dd_invite_gem { width: 15px; height: 15px; flex: 0 0 auto; object-fit: contain; image-rendering: pixelated; }

/* The game's name, beside the invite while a game is open. */
.dd_brand[hidden] { display: none; }
.dd_brand::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 13px;
  margin-right: 12px;
  vertical-align: -2px;
  background: var(--sh-line);
}

.dd_back {
  border: 0;
  background: var(--sh-row);
  color: var(--sh-sub);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.dd_back:hover { background: var(--sh-row-hover); color: var(--sh-head); }

/* The wallet sits where a client parks the account: hard right, quiet, always there.
   The name is the Minecraft one, because that is the account the money belongs to. */
.dd_wallet {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
/* `display` here would otherwise beat the `hidden` attribute, and the bar would show an
   empty balance beside a boot screen that has not asked the server who anyone is yet. */
.dd_wallet[hidden] { display: none; }
.dd_wallet_ign { font-size: 13px; color: var(--sh-mute); }
.dd_wallet_value {
  font-size: 15px;
  font-weight: 700;
  color: var(--sh-head);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- screens */

.dd_main { flex: 1 1 auto; min-height: 0; display: flex; }
.dd_screen { flex: 1 1 auto; min-height: 0; min-width: 0; }
.dd_screen[hidden] { display: none !important; }

.dd_center { display: flex; align-items: center; justify-content: center; padding: 24px; }
.dd_boot { color: var(--sh-mute); font-size: 14px; }
.dd_boot_name { color: #f2f3f5; font-weight: 600; }
/* Red enough to read as live, dark enough not to shout at a loading screen. */
.dd_boot_live { color: #c9414a; font-weight: 600; }
.dd_blocked {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
  text-align: center;
}
.dd_blocked b { font-size: 18px; color: var(--sh-head); }
/* pre-line so a boot failure can put its reason on its own line under the advice. */
.dd_blocked span { font-size: 14px; color: var(--sh-sub); line-height: 1.45; white-space: pre-line; }

/* ---------------------------------------------------------------- the lobby */

.dd_lobby { overflow: auto; }
.dd_lobby_inner { max-width: 940px; margin: 0 auto; padding: 20px 18px 32px; }

/* The catalogue is the client's directory listing laid out as a grid rather than a
   column: the rows are the same object — mark, name, one line about it — and there are
   nine of them, which is a column long enough to scroll and a grid short enough not to. */
.dd_tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}
.dd_tiles .sh_act { min-height: 62px; }

/* ---------------------------------------------------------------- the bet log */

.dd_recent { margin-top: 4px; }
.dd_recent_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.dd_recent_table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sh-mute);
  padding: 6px 10px;
  border-bottom: 1px solid var(--sh-line);
}
.dd_recent_table td {
  padding: 7px 10px;
  color: var(--sh-sub);
  border-bottom: 1px solid var(--sh-line);
}
.dd_recent_table tr:hover td { background: var(--sh-row); }
.dd_recent_table td.g { color: var(--sh-head); font-weight: 500; }
/* The id is the whole point of the row — it is what /provablyfair takes — so it is set
   in the figure face and never wrapped. */
.dd_recent_table td.id {
  font-family: var(--sh-mono);
  font-size: 12px;
  color: var(--sh-mute);
  white-space: nowrap;
}
.dd_recent_table td.win { color: var(--sh-win); }
.dd_recent_table td.lose { color: var(--sh-lose); }
.dd_recent_empty { padding: 14px 10px; color: var(--sh-mute); font-size: 13px; }

/* ---------------------------------------------------------------- toast */

.dd_toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 12px);
  z-index: 400;
  max-width: min(420px, calc(100% - 32px));
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--sh-raise);
  border: 1px solid var(--sh-line);
  color: var(--sh-text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.dd_toast.show { opacity: 1; transform: translate(-50%, 0); }
.dd_toast.error { border-color: var(--sh-lose); color: var(--sh-head); }

/* ---------------------------------------------------------------- bet slip */

.dd_bet_wrap {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .6);
}
.dd_bet_wrap.open { display: flex; }
.dd_bet_card {
  width: min(420px, 100%);
  background: var(--sh-raise);
  border: 1px solid var(--sh-line);
  border-radius: 10px;
  padding: 14px 16px 16px;
}
.dd_bet_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  color: var(--sh-head);
  margin-bottom: 10px;
}
.dd_bet_close {
  border: 0;
  background: transparent;
  color: var(--sh-mute);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.dd_bet_row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--sh-sub);
}
.dd_bet_row b { color: var(--sh-head); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dd_bet_row b.pos { color: var(--sh-win); }
.dd_bet_note { margin-top: 10px; font-size: 12px; color: var(--sh-mute); line-height: 1.5; }
.dd_bet_note b { color: var(--sh-sub); }

/* The copy buttons the fairness fields carry (dd.fairFieldsMarkup). */
.bet_copy {
  border: 0;
  background: transparent;
  color: var(--sh-mute);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
}
.bet_copy:hover, .bet_copy.copied { color: var(--secondary); }

/* ---------------------------------------------------------------- the coin badge

   One balance, so the badge in the stake box names it rather than opening a list. */
.dd_coin_badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--sh-mute);
  pointer-events: none;
}

/* ---------------------------------------------------------------- boards

   Three boards differ in shape from the ones the sheets were written for. Everything
   else — mines, towers, limbo, the panels, the pays row — is drawn by ui.css and
   shell.css exactly as it is drawn on the site. */

/* keno is 25 tiles here (KENO_POOL_SIZE), so the board is 5 across rather than 8. */
body.chat_app #game_root .dd_keno {
  grid-template-columns: repeat(5, 1fr);
  max-width: 460px;
}

/* The ring has three colours, not two: black and red alternating with one gold. Same
   treatment as the site's tiles — the number and its outline in one colour, no fill —
   so the strip stays a row of stamps. */
.roul_tile.red { background: transparent; border: 1px solid #d0455a; color: #d0455a; }
.roul_tile.gold { background: transparent; border: 1px solid #e2b23c; color: #e2b23c; }

/* slots is a 3×3 board, so the reels stack into rows. */
.dd_board_slots { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.dd_board_slots .dd_reels { gap: 8px; }
body.chat_app #game_root .dd_board_slots .dd_reel { font-size: 30px; }

/* plinko draws its peg field above the bucket row the site already styles. */
.plink_stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.plink_pegs { display: flex; flex-direction: column; gap: 9px; align-items: center; }
.plink_row { display: flex; gap: 14px; justify-content: center; }
.plink_peg { width: 5px; height: 5px; border-radius: 50%; background: var(--sh-line); }
.plink_ball {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 10px var(--secondary);
  transition: left .1s linear, top .1s ease-in;
  pointer-events: none;
}

/* The game window is the whole surface here rather than a popover over a composer, so
   it is free to use the height it has. */
.sh_table .sh_games_win { max-height: none; }
