/* ============================================================
   CRAPS.NOW — Game table, dice, chips, and multiplayer UI
   Loaded on top of main.css (site design system).
   ============================================================ */

:root {
  --felt: #1a6b3c;
  --felt-dark: #14532d;
  --felt-light: #22834b;
  --felt-line: rgba(255, 255, 255, 0.22);
  --card-red: #d02b2b;
  --card-black: #1e293b;
  --card-w: 100;   /* logical units; the board scales via transform */
  --gold: #fbbf24;
}

/* ---- GAME SHELL ---- */
.game-shell {
  background: radial-gradient(ellipse at 50% -20%, var(--felt-light), var(--felt) 55%, var(--felt-dark));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 0 80px rgba(0,0,0,.25);
  padding: .75rem .75rem 1.25rem;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---- TABLE THEMES (applied to .game-shell) ---- */
.game-shell.table-blue   { background: radial-gradient(ellipse at 50% -20%, #3b82f6, #1e5fbf 55%, #143a7a); }
.game-shell.table-charcoal { background: radial-gradient(ellipse at 50% -20%, #3a4453, #262d38 55%, #171b22); }
.game-shell.table-wood   { background: radial-gradient(ellipse at 50% -20%, #a9744f, #7a4e2e 55%, #4d3019); }
.game-shell.table-purple { background: radial-gradient(ellipse at 50% -20%, #8b5cf6, #6d3fd4 55%, #45278a); }
.game-shell.table-crimson { background: radial-gradient(ellipse at 50% -20%, #ef4444, #c0392b 55%, #7f2018); }

/* When the game is fullscreen, fill the viewport. */
.game-shell:fullscreen { display:flex; flex-direction:column; justify-content:center; border-radius:0; padding:1rem; }
.game-shell:fullscreen .board-wrap { flex:1; display:flex; align-items:center; }

/* ---- CARD BACK THEMES (applied via .board[data-back]) ---- */
.board[data-back="blue"] .card .back { background: repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 6px, transparent 6px 12px), linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.board[data-back="red"] .card .back { background: repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 6px, transparent 6px 12px), linear-gradient(135deg, #dc2626, #7f1d1d); }
.board[data-back="charcoal"] .card .back { background: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 6px, transparent 6px 12px), linear-gradient(135deg, #334155, #0f172a); }
.board[data-back="lattice"] .card .back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.16) 0 3px, transparent 3px 9px),
    linear-gradient(135deg, #15803d, #14532d);
}
/* Disable animations when the player turns them off. */
.board.no-animations .card { transition: none !important; }

/* ---- TOOLBAR ---- */
.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .35rem .5rem .6rem;
}
.game-stats {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
  font-weight: 600;
}
.game-stats .stat-label {
  opacity: .65;
  font-weight: 500;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: .25rem;
}
.game-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn-felt {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-sm);
  padding: .35rem .7rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.btn-felt:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn-felt:disabled { opacity: .4; cursor: default; }
.btn-felt.btn-felt-primary { background: var(--gold); border-color: var(--gold); color: #713f12; }
.btn-felt.btn-felt-primary:hover { background: #fcd34d; }

/* ---- BOARD ---- */
/* main.css (inherited from the sudoku design system) makes .board-wrap a
   centered flex column, which mis-centers the transformed board and clips
   its right edge. Force plain block flow; the engine centers via margin. */
.board-wrap {
  position: relative;
  width: 100%;
  display: block;
  gap: 0;
  overflow: hidden;
}
/* CLS defense: reserve space for the JS-built table so the page below it
   doesn't jump if the engine scripts are still loading at first paint. The
   engine clears this (inline min-height:0) the moment the table is built. */
#board-wrap { min-height: 360px; }
@media (max-width: 640px) { #board-wrap { min-height: 460px; } }
.board {
  position: relative;
  transform-origin: top left;
}
.board * { -webkit-tap-highlight-color: transparent; }

/* NOTE: `.card`, `.pile`, `.red`, `.black`, `.selected` etc. are generic
   names that also exist in the site design system (main.css `.card` is a
   white content box). Every board-specific rule below is scoped under
   `.board` so it can never leak onto content pages (contact form, auth
   cards, blog cards). Do not un-scope these. */

/* ---- PILES ---- */
.board .pile {
  position: absolute;
  border-radius: 9px;
  border: 2px solid var(--felt-line);
  background: rgba(0,0,0,.12);
  box-shadow: inset 0 1px 6px rgba(0,0,0,.18);
}
.board .pile .pile-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: rgba(255,255,255,.28);
  font-weight: 700;
  pointer-events: none;
}
.board .pile.drop-ok { border-color: var(--gold); background: rgba(251,191,36,.15); }
.board .pile.stock-pile { cursor: pointer; }
.board .pile.hint-glow, .board .card.hint-glow {
  animation: hintPulse 1s ease-in-out 2;
}
@keyframes hintPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,0); }
  50% { box-shadow: 0 0 0 6px rgba(251,191,36,.75); }
}

/* ---- CARDS ---- */
.board .card {
  position: absolute;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  cursor: default;
  will-change: transform;
  transition: left .18s ease, top .18s ease;
  overflow: hidden;
}
.board .card.no-anim { transition: none; }
.board .card.draggable { cursor: grab; }
.board .card.dragging {
  transition: none;
  z-index: 1000 !important;
  cursor: grabbing;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
}
.board .card.drop-ok { outline: 3px solid var(--gold); outline-offset: -3px; }
.board .card.selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.board .card.shake { animation: cardShake .25s ease; }
@keyframes cardShake {
  0%,100% { margin-left: 0; }
  25% { margin-left: -5px; }
  75% { margin-left: 5px; }
}

.board .card .face {
  position: absolute; inset: 0;
  display: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
}
.board .card .back {
  position: absolute; inset: 0;
  border-radius: 9px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #15803d, #14532d);
  border: 4px solid #fff;
}
.board .card.face-up .face { display: block; }
.board .card.face-up .back { display: none; }

.board .card .corner {
  position: absolute;
  top: 4px; left: 5px;
  line-height: 1;
  text-align: center;
  font-weight: 700;
  font-family: var(--font);
}
.board .card .corner .rank { font-size: 22px; display: block; letter-spacing: -1px; }
.board .card .corner .suit { font-size: 17px; display: block; margin-top: -1px; }
.board .card .corner-br {
  top: auto; left: auto; bottom: 4px; right: 5px;
  transform: rotate(180deg);
}
.board .card .pip-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  opacity: .9;
}
.board .card.red { color: var(--card-red); }
.board .card.black { color: var(--card-black); }

/* Waste fan spacing handled by engine positioning. */

/* ---- WIN OVERLAY ---- */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 40, 24, .82);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  border-radius: var(--radius-lg);
}
.game-overlay.open { display: flex; }
.game-overlay-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 2.25rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  text-align: center;
}
.game-overlay-card h2,
.game-overlay-card .overlay-title { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-bottom: .5rem; }
.win-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0 1.25rem;
}
.win-stats > div { text-align: center; }
.win-stats .num { font-size: 1.4rem; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.win-stats .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.overlay-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

/* ---- SETTINGS MODAL ---- */
.cn-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,.55);
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.cn-modal.open { display: flex; }
.cn-modal-card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 440px; max-width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 1.25rem 1.5rem 1.5rem;
}
.cn-modal-card h2 { font-size: 1.2rem; margin-bottom: 1rem; display:flex; justify-content:space-between; align-items:center; }
.cn-modal-close { background:none; border:none; font-size:1.4rem; cursor:pointer; color:var(--text-muted); line-height:1; }
.cn-set-row { margin-bottom: 1.1rem; }
.cn-set-row > .cn-set-label { font-weight:600; font-size:.9rem; margin-bottom:.45rem; display:block; }
.cn-swatches { display:flex; gap:.5rem; flex-wrap:wrap; }
.cn-swatch {
  width:44px; height:32px; border-radius:8px; cursor:pointer;
  border:3px solid transparent; box-shadow: var(--shadow-sm);
}
.cn-swatch.active { border-color: var(--gold); }
.cn-swatch.dice-swatch { width:34px; height:48px; border-radius:6px; border-width:2px; }
.cn-toggle-row { display:flex; align-items:center; justify-content:space-between; padding:.4rem 0; }
.cn-toggle-row label { font-size:.9rem; }
.cn-seg { display:inline-flex; border:1px solid var(--border); border-radius:999px; overflow:hidden; }
.cn-seg button { border:none; background:var(--surface); padding:.3rem .8rem; font-size:.82rem; font-weight:600; cursor:pointer; color:var(--text); font-family:var(--font); }
.cn-seg button.active { background:var(--blue); color:#fff; }

/* ---- CONFETTI ---- */
.confetti {
  position: absolute;
  width: 10px; height: 14px;
  top: -20px;
  z-index: 1100;
  pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .2; }
}

/* Concise factual intro under the hero (positioning + answer-engine summary). */
.home-intro {
  margin: .25rem 0 1rem;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.home-intro strong { color: var(--text); }

/* ---- GAME PAGE LAYOUT ---- */
.game-header { margin: 1.25rem 0 .75rem; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.game-header h1 { font-size: 1.45rem; }
.game-header .tagline { color: var(--text-muted); font-size: .92rem; }
.mode-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.mode-tab {
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
}
.mode-tab:hover { border-color: var(--blue); color: var(--blue); }
.mode-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Below-the-fold content */
.game-content { margin-top: 2.5rem; }
.game-content h2 { margin: 2rem 0 .75rem; font-size: 1.35rem; }
.game-content h3 { margin: 1.25rem 0 .5rem; }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; margin: 1rem 0; }
.howto-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.howto-card h3 { margin: 0 0 .4rem; font-size: 1rem; color: var(--blue-dark); }
.howto-card p { font-size: .9rem; margin: 0; }
/* Illustration woven into the top of a how-to card (full-bleed banner strip). */
.howto-card.has-img { padding-top: 0; overflow: hidden; }
.howto-card .howto-img {
  width: calc(100% + 2.5rem);
  /* Override the global `img { max-width: 100% }`, which would otherwise cap
     this full-bleed banner to the content width and, combined with the negative
     margins, leave a white gap on the right. */
  max-width: none;
  margin: 0 -1.25rem .95rem;
  height: 200px;
  object-fit: cover;
  object-position: center;
  display: block;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 480px) {
  .howto-card .howto-img { height: 170px; }
}
.strategy-list { margin: .75rem 0 1rem 1.25rem; color: var(--text-muted); }
.strategy-list li { margin-bottom: .55rem; font-size: .95rem; }
ol.strategy-list.numbered { list-style: decimal; padding-left: .5rem; }
ol.strategy-list.numbered li { padding-left: .35rem; }
ol.strategy-list.numbered li::marker { color: var(--blue); font-weight: 800; }

/* TL;DR summary box */
.tldr {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: .8rem 1.1rem;
  font-size: .96rem;
  line-height: 1.65;
  margin: 0 0 1.25rem;
  color: var(--text);
}
.tldr strong { color: var(--blue-dark); }

/* Highlighted "top tip" callout */
.tip-callout {
  background: var(--accent-light, #fffbeb);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .95rem;
  line-height: 1.6;
  margin: .5rem 0 1rem;
}

/* Clean two-column facts table */
.facts-table {
  width: 100%;
  border-collapse: collapse;
  margin: .5rem 0 1.5rem;
  font-size: .93rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts-table th, .facts-table td { padding: .6rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.facts-table tr:last-child th, .facts-table tr:last-child td { border-bottom: none; }
.facts-table th { width: 34%; background: var(--surface-2); font-weight: 700; color: var(--text); white-space: nowrap; }
.facts-table td { color: var(--text-muted); }
@media (max-width: 520px) {
  .facts-table th { width: 42%; white-space: normal; }
}

/* ---- FAQ ACCORDION (collapsible hub) ---- */
.faq-accordion { margin-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.faq-acc-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-acc-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-acc-item summary::-webkit-details-marker { display: none; }
.faq-acc-item summary h3 { font-size: 1rem; margin: 0; color: var(--text); }
.faq-acc-item[open] summary h3 { color: var(--blue-dark); }
.faq-acc-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform .2s ease; }
.faq-acc-item[open] .faq-acc-chevron { transform: rotate(180deg); }
.faq-acc-item summary:hover h3 { color: var(--blue); }
.faq-acc-body { padding: 0 1.25rem 1.15rem; }
.faq-acc-body p { font-size: .92rem; margin: 0; color: var(--text-muted); }

.faq-list { margin-top: 1rem; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}
.faq-item h3 { margin: 0 0 .4rem; font-size: 1rem; }
.faq-item p { font-size: .92rem; margin: 0; }

.variant-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.variant-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  color: var(--text);
}
.variant-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--blue-border); color: var(--text); }
.variant-card .vc-name { font-weight: 700; color: var(--blue-dark); margin-bottom: .25rem; display: flex; align-items: center; gap: .4rem; }
.variant-card .vc-tag { font-size: .84rem; color: var(--text-muted); line-height: 1.45; }
.variant-card .vc-meta { margin-top: .6rem; font-size: .72rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .04em; }

/* ---- 404 PAGE ---- */
.nf-hero {
  position: relative;
  text-align: center;
  color: #fff;
  background: radial-gradient(ellipse at 50% -10%, var(--felt-light), var(--felt) 55%, var(--felt-dark));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 0 80px rgba(0,0,0,.25);
  padding: 2.5rem 1.25rem 2.75rem;
  overflow: hidden;
}
.nf-hero h1 { color: #fff; font-size: 1.7rem; margin: .25rem 0 .5rem; }
.nf-hero p { color: rgba(255,255,255,.85); max-width: 34rem; margin: 0 auto 1.5rem; line-height: 1.6; }
.nf-code {
  font-size: 3rem; font-weight: 800; letter-spacing: .1em;
  color: var(--gold); line-height: 1; margin-top: 1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nf-cards { display: flex; justify-content: center; align-items: flex-end; gap: -1rem; height: 118px; margin-bottom: .25rem; }
.nf-card {
  width: 76px; height: 106px; border-radius: 10px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 8px 18px rgba(0,0,0,.35);
  margin: 0 -8px;
}
.nf-card b { font-size: 1.5rem; line-height: 1; }
.nf-card i { font-style: normal; font-size: 1.6rem; line-height: 1; }
.nf-card.red { color: var(--card-red); transform: rotate(-12deg); }
.nf-card.black { color: var(--card-black); transform: rotate(12deg); }
.nf-card.back {
  color: rgba(255,255,255,.9); font-size: 2rem; transform: translateY(-14px) scale(1.06);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #15803d, #14532d);
  border: 4px solid #fff; z-index: 2;
}
.nf-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.btn-outline-light {
  background: transparent; border: 1px solid rgba(255,255,255,.55); color: #fff;
  padding: .55rem 1.1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
}
.btn-outline-light:hover { background: rgba(255,255,255,.14); color: #fff; }
.nf-linkcols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.25rem;
  margin-top: 1rem; text-align: left;
}
.nf-linkcols h3 { font-size: 1rem; color: var(--blue-dark); margin-bottom: .5rem; }
.nf-linkcols ul { list-style: none; padding: 0; margin: 0; }
.nf-linkcols li { margin-bottom: .4rem; }
.nf-linkcols a { font-size: .92rem; }

/* ---- MULTIPLAYER ---- */
.mp-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.mp-players { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.mp-player { padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.mp-player.me { border-color: var(--blue-border); background: var(--blue-light); }
.mp-player .mp-name { font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.mp-player .mp-status { font-size: .75rem; color: var(--text-muted); }
.mp-progress-track {
  height: 10px; border-radius: 999px; background: var(--surface-3);
  margin-top: .5rem; overflow: hidden;
}
.mp-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--blue), #22c55e);
  border-radius: 999px;
  transition: width .4s ease;
}
.mp-code {
  font-size: 1.6rem; font-weight: 800; letter-spacing: .35em;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem .4rem .9rem;
  display: inline-block;
}
.mp-chat { max-height: 180px; overflow-y: auto; font-size: .85rem; margin: .5rem 0; }
.mp-chat .mp-chat-line { margin-bottom: .25rem; }
.mp-chat .mp-chat-name { font-weight: 700; color: var(--blue-dark); }
.mp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mp-dot.on { background: #22c55e; }
.mp-dot.off { background: #cbd5e1; }

/* ---- RATING WIDGET ---- */
.rating-widget {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: .7rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: .9rem;
}
.rating-label { font-weight: 600; color: var(--text); }
.rating-stars { display: inline-flex; }
.rating-star {
  background: none; border: none; cursor: pointer; padding: 0 .1rem;
  font-size: 1.5rem; line-height: 1; color: #d1d5db; transition: color .1s;
}
.rating-star.on { color: var(--gold); }
.rating-star:hover { color: #fcd34d; }
.rating-summary { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rating-widget.rated .rating-label::after { content: " thanks!"; color: var(--blue); font-weight: 400; }

/* ---- STATS BAR (localStorage per-game) ---- */
.stats-strip {
  display: flex; gap: 1.75rem; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-sm);
}
.stats-strip > div { text-align: center; }
.stats-strip .num { font-weight: 800; font-size: 1.1rem; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.stats-strip .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }

@media (max-width: 640px) {
  .game-shell { padding: .4rem .4rem .75rem; border-radius: var(--radius); }
  .game-stats { gap: .6rem; font-size: .78rem; }
  .mp-players { grid-template-columns: 1fr; }
  .game-header h1 { font-size: 1.2rem; }
}

/* ============================================================
   CRAPS TABLE (ct-*) — the betting layout, dice and chips.
   Built by craps.js inside .board.craps-board. All fluid CSS
   grid/flex; no transform scaling needed.
   ============================================================ */

.craps-board { padding: .25rem .35rem .6rem; }

/* ---- Top strip: puck, dice, roll button ---- */
.ct-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: .5rem .25rem .35rem;
  flex-wrap: wrap;
}
.ct-puck {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .72rem; letter-spacing: .02em;
  border: 3px solid rgba(0,0,0,.35);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  flex-shrink: 0;
  text-align: center;
}
.ct-puck.off { background: #1e293b; color: #fff; }
.ct-puck.on { background: #fff; color: #1e293b; }

.ct-dice { display: flex; gap: .6rem; }
.ct-die {
  width: 54px; height: 54px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fffbeb, #e7e5e4);
  box-shadow: 0 3px 8px rgba(0,0,0,.4), inset 0 -2px 4px rgba(0,0,0,.12);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 7px;
  gap: 2px;
}
.ct-pip {
  border-radius: 50%;
  background: #1e293b;
  opacity: 0;
  align-self: center; justify-self: center;
  width: 9px; height: 9px;
}
/* Pip layouts per face value (3x3 grid, children 1-9). */
.ct-die[data-v="1"] .ct-pip:nth-child(5) { opacity: 1; }
.ct-die[data-v="2"] .ct-pip:nth-child(1), .ct-die[data-v="2"] .ct-pip:nth-child(9) { opacity: 1; }
.ct-die[data-v="3"] .ct-pip:nth-child(1), .ct-die[data-v="3"] .ct-pip:nth-child(5), .ct-die[data-v="3"] .ct-pip:nth-child(9) { opacity: 1; }
.ct-die[data-v="4"] .ct-pip:nth-child(1), .ct-die[data-v="4"] .ct-pip:nth-child(3),
.ct-die[data-v="4"] .ct-pip:nth-child(7), .ct-die[data-v="4"] .ct-pip:nth-child(9) { opacity: 1; }
.ct-die[data-v="5"] .ct-pip:nth-child(1), .ct-die[data-v="5"] .ct-pip:nth-child(3), .ct-die[data-v="5"] .ct-pip:nth-child(5),
.ct-die[data-v="5"] .ct-pip:nth-child(7), .ct-die[data-v="5"] .ct-pip:nth-child(9) { opacity: 1; }
.ct-die[data-v="6"] .ct-pip:nth-child(1), .ct-die[data-v="6"] .ct-pip:nth-child(3), .ct-die[data-v="6"] .ct-pip:nth-child(4),
.ct-die[data-v="6"] .ct-pip:nth-child(6), .ct-die[data-v="6"] .ct-pip:nth-child(7), .ct-die[data-v="6"] .ct-pip:nth-child(9) { opacity: 1; }

.ct-die.rolling { animation: dieShake .28s linear infinite; }
@keyframes dieShake {
  0% { transform: translate(0,0) rotate(0); }
  25% { transform: translate(2px,-3px) rotate(6deg); }
  50% { transform: translate(-2px,2px) rotate(-5deg); }
  75% { transform: translate(2px,2px) rotate(3deg); }
  100% { transform: translate(0,0) rotate(0); }
}
.board.no-animations .ct-die.rolling { animation: none; }

/* Dice themes (set via .board[data-dice]) */
.board[data-dice="red"] .ct-die { background: linear-gradient(135deg, #ef4444, #991b1b); }
.board[data-dice="red"] .ct-pip { background: #fff; }
.board[data-dice="blue"] .ct-die { background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.board[data-dice="blue"] .ct-pip { background: #fff; }
.board[data-dice="black"] .ct-die { background: linear-gradient(135deg, #334155, #0f172a); }
.board[data-dice="black"] .ct-pip { background: #fff; }
.board[data-dice="gold"] .ct-die { background: linear-gradient(135deg, #fbbf24, #b45309); }
.board[data-dice="gold"] .ct-pip { background: #422006; }

.ct-roll-btn {
  background: var(--gold);
  color: #713f12;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.05rem;
  padding: .7rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
  transition: transform .1s, background .15s;
}
.ct-roll-btn:hover { background: #fcd34d; transform: translateY(-1px); }
.ct-roll-btn:disabled { opacity: .45; cursor: default; transform: none; }

/* ---- Message line ---- */
.ct-msg {
  text-align: center;
  color: rgba(255,255,255,.92);
  font-size: .85rem;
  font-weight: 600;
  min-height: 1.4em;
  padding: 0 .5rem .5rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ---- Layout zones ---- */
.ct-layout { display: flex; flex-direction: column; gap: .5rem; padding: 0 .1rem; }
.ct-zone { display: flex; gap: .5rem; flex-wrap: wrap; }
.ct-numbers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .5rem;
}
.ct-numbers-10 { grid-template-columns: repeat(10, 1fr); }
.ct-numbox {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}
.ct-mid, .ct-line, .ct-props, .ct-picker { align-items: stretch; }
.ct-line-solo { justify-content: center; }
.ct-props { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }

/* ---- Betting spots ---- */
.ct-spot {
  border: 2px solid var(--felt-line);
  border-radius: 9px;
  background: rgba(0,0,0,.14);
  box-shadow: inset 0 1px 6px rgba(0,0,0,.18);
  color: #fff;
  text-align: center;
  padding: .45rem .3rem .5rem;
  cursor: pointer;
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  transition: background .12s, border-color .12s;
  user-select: none;
  -webkit-user-select: none;
  /* Long-press removes a bet; suppress the iOS text-selection / lookup callout
     and the double-tap-zoom delay so taps register instantly. */
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.ct-spot:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.45); }
.ct-spot.wide { flex-basis: 100%; }
.ct-spot.pass { border-color: var(--gold); }
.ct-spot.field { background: rgba(255,255,255,.06); }
.ct-spot.ct-place { font-variant-numeric: tabular-nums; }
.ct-spot.ct-tall { padding: .9rem .5rem 1rem; }
.ct-spot.ct-mini { padding: .2rem .2rem .25rem; }
.ct-spot.ct-mini .ct-spot-label { font-size: .55rem; opacity: .8; }
.ct-spot-label { font-weight: 800; font-size: .82rem; letter-spacing: .03em; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.ct-numbox .ct-place .ct-spot-label { font-size: 1.25rem; }
.ct-spot-sub { font-size: .6rem; opacity: .75; margin-top: .1rem; line-height: 1.3; }
.ct-spot.unavailable { opacity: .45; cursor: not-allowed; }
.ct-spot.locked { border-style: dashed; }
.ct-spot.locked::after {
  content: "🔒";
  position: absolute; top: 2px; right: 4px;
  font-size: .55rem; opacity: .8;
}
.ct-spot.hint-glow { animation: hintPulse 1s ease-in-out 2; }
.ct-spot.win-flash { background: rgba(251,191,36,.4); border-color: var(--gold); }
.ct-spot.lose-flash { background: rgba(220,38,38,.45); border-color: #ef4444; }

/* ---- Chips ---- */
.ct-chipstack { min-height: 30px; display: flex; align-items: center; justify-content: center; margin-top: .25rem; }
.ct-chip {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .72rem;
  font-family: var(--font);
  color: #fff;
  border: 3px dashed rgba(255,255,255,.75);
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
  cursor: pointer;
  flex-shrink: 0;
}
.ct-chip.d5 { background: #b91c1c; }
.ct-chip.d10 { background: #1d4ed8; }
.ct-chip.d25 { background: #15803d; }
.ct-chip.d100 { background: #0f172a; }
.ct-chip.selected { outline: 3px solid var(--gold); outline-offset: 2px; }
.ct-chip.on-spot { width: 40px; height: 40px; cursor: inherit; }

.ct-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .7rem .25rem .25rem;
}
.ct-tray-label { color: rgba(255,255,255,.8); font-size: .75rem; font-weight: 700; }
.ct-tray-hint { color: rgba(255,255,255,.55); font-size: .68rem; flex-basis: 100%; text-align: center; }

/* ---- Hazard main picker ---- */
.ct-picker { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .1rem 0 .2rem; }
.ct-picker-label { color: rgba(255,255,255,.85); font-size: .8rem; font-weight: 700; }
.ct-main-btn {
  width: 40px; height: 40px;
  border-radius: 9px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 2px solid rgba(255,255,255,.35);
  font-family: var(--font);
  font-weight: 800; font-size: 1rem;
  cursor: pointer;
}
.ct-main-btn:hover { background: rgba(255,255,255,.22); }
.ct-main-btn.selected { background: var(--gold); color: #713f12; border-color: var(--gold); }

/* ---- 404 dice hero ---- */
.nf-dice { display: flex; justify-content: center; align-items: flex-end; gap: .8rem; height: 96px; margin-bottom: .5rem; }
.nf-die {
  width: 64px; height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffbeb, #e7e5e4);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  padding: 12px; gap: 4px;
}
.nf-die i { width: 12px; height: 12px; border-radius: 50%; background: #b91c1c; align-self: center; justify-self: center; }
.nf-die.v4 { transform: rotate(-10deg); }
.nf-die.v4 ~ .nf-die.v4 { transform: rotate(10deg); }
.nf-die.back {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
  color: #fff; font-size: 1.8rem; font-weight: 800;
  transform: translateY(-8px);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .ct-numbers, .ct-numbers-10 { grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); }
  .ct-die { width: 44px; height: 44px; padding: 6px; }
  .ct-pip { width: 7px; height: 7px; }
  .ct-puck { width: 44px; height: 44px; font-size: .62rem; }
  .ct-roll-btn { font-size: 1rem; padding: .6rem 1.4rem; min-height: 46px; }
  .ct-spot-label { font-size: .7rem; }
  .ct-numbox .ct-place .ct-spot-label { font-size: 1rem; }
  .ct-spot-sub { display: none; }
  /* Comfortable finger-sized tap targets for the tray chips and the hazard
     main picker (the on-spot chip keeps its own smaller size). */
  .ct-chip { width: 44px; height: 44px; font-size: .7rem; }
  .ct-main-btn { width: 46px; height: 46px; font-size: 1.05rem; }
  /* Toolbar buttons (Undo/Hint/Settings/Fullscreen/New) - meet the 44px
     minimum so they're easy to hit on a phone. */
  .btn-felt { min-height: 44px; padding: .5rem .8rem; }
}
