/* The game table: a full-screen stage with a thin bar of controls over it. */
.stage { position: relative; height: 100vh; height: 100svh; min-height: 420px; background: #021413; color: #eef6f2; overflow: hidden; font: 15px/1.2 var(--font); color-scheme: dark; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.stage canvas.grab { cursor: grab; }
.stage canvas.grabbing { cursor: grabbing; }
.stage canvas.pointer { cursor: pointer; }

.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .home { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 600; opacity: .9; }
.hud .home:hover { text-decoration: none; opacity: 1; }
.hud .home span { color: rgba(238, 246, 242, .6); font-weight: 500; }
.stats { margin: 0 auto; display: flex; gap: 8px; }
.pill, .hud button, .hud .link { background: rgba(4, 28, 26, .55); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 8px 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: inherit; }
.pill span { opacity: .6; margin-inline-end: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.pill b { font-variant-numeric: tabular-nums; font-weight: 600; }
.hud button, .hud .link { font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
.hud button:hover, .hud .link:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.hud button:active { transform: scale(.96); }

/* Backgammon: what is happening now, in one line under the board. */
#status { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-weight: 600; pointer-events: none; min-height: 1.2em; padding: 0 12px; }
[data-kind="board"] .stage { background: #0e1b18; }

.stage.bare .hud, .stage.bare #status { display: none; }

/* Shown while a game waits for the first press: browsers keep sound off until then, and the
   game does not start its opening in silence. */
#start { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
#start.show { opacity: 1; }
#start span { padding: 16px 28px; border-radius: 999px; background: rgba(3, 22, 21, .72); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 20px; font-weight: 600; animation: start-pulse 1.6s ease-in-out infinite; }
@keyframes start-pulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { #start span { animation: none; } }
.stage.bare #start { display: none; }

#win { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .6s; }
#win.show { opacity: 1; pointer-events: auto; }
#win .card { text-align: center; padding: 28px 40px 30px; border-radius: 24px; background: rgba(3, 22, 21, .72); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transform: translateY(12px) scale(.96); transition: transform .6s cubic-bezier(.2, 1.3, .4, 1); }
#win.show .card { transform: none; }
#win h2 { margin: 0 0 6px; font-size: 34px; }
#win .card > p { margin: 0 0 20px; opacity: .75; }
#win .card > button { background: #e6c46a; color: #1c1503; border: 0; border-radius: 999px; padding: 11px 24px; font: inherit; font-weight: 600; cursor: pointer; }
#win .card > button:hover { background: #f2d688; }

.nogl { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 30px; }
.stage.failed .nogl { display: grid; }

@media (max-width: 720px) {
  .hud { gap: 6px; padding: 10px; }
  .hud .home span, .pill span, .hud .link { display: none; }
  .pill, .hud button { padding: 7px 10px; font-size: 13px; }
  #status { font-size: 14px; bottom: 10px; }
}

/* Games with their own counters and buttons have more to show: when the bar runs out of room,
   the buttons take a second row. The engine measures the bar and keeps the board clear of it. */
[data-kind="board"] .hud { flex-wrap: wrap; row-gap: 8px; }
[data-kind="board"] .stats { margin: 0 0 0 auto; }
[data-kind="board"] .hud .link { margin-inline-start: auto; }
@media (max-width: 900px) {
  [data-kind="board"] .pill span { display: inline; }
  [data-kind="board"] .hud .link { display: none; }
  [data-kind="board"] .stats + .link + button, [data-kind="board"] .stats + button { margin-inline-start: auto; }
}

/* The result card's second button, and the deal of the day in the counters. */
#win .card > button.quiet { background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .3); margin-inline-start: 10px; }
#win .card > button.quiet:hover { background: rgba(255, 255, 255, .12); }
.pill.deal { font-weight: 600; white-space: nowrap; }

/* The code that puts a game on another site. */
.embed-code { display: grid; gap: 10px; justify-items: start; }
.embed-code textarea { width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 12px; border-radius: 12px; border: 1px solid var(--line, rgba(0, 0, 0, .15)); background: transparent; color: inherit; resize: vertical; }

/* The copy inside another site's frame: the table fills the frame. */
body.embed { margin: 0; }
body.embed .stage { height: 100vh; height: 100svh; min-height: 0; }

/* Stars and the way to the Feedback page on the result card. */
.win-rate { margin: 22px 0 0; padding: 16px 0 0; background: none; border-radius: 0; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 14px; }
.win-rate .rate-hint { margin: 0 0 2px; color: inherit; opacity: .75; }
.win-rate .stars button { font-size: 30px; color: rgba(255, 255, 255, .28); }
.win-rate .stars button.on, .win-rate .stars:hover button { color: #f5c542; }
.win-rate .stars button:hover ~ button { color: rgba(255, 255, 255, .28); }
.win-rate .care-status { margin: 4px 0 0; font-size: 14px; }
.win-rate .care-status.ok { color: #9be0b8; }
.win-rate .care-status.err { color: #ff9d94; }
.win-rate a { display: block; margin-top: 8px; color: inherit; opacity: .8; text-decoration: underline; }
