/* ==========================================================================
   Game Night: the board games (Chess, Checkers, Mancala), the host putting the
   lobby in order, and rock paper scissors on the side. Uses the tokens from style.css.
   ========================================================================== */

/* ---------- the lobby: the host drags people into order ---------- */
.pchip { position: relative; }
.pchip .pnum {
  flex: none; min-width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 999px; padding: 0 .3em;
  background: rgba(0,0,0,.4); color: var(--gold-hi); font-family: var(--display); font-weight: 700; font-size: .95em;
}
.pchip .pnum .ic { width: 1em; height: 1em; color: var(--soft); }
.pchip.bench { opacity: .78; }
.pchip.bench .pnum { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.pchip.drag { cursor: grab; }
.pchip .grip { flex: none; display: grid; gap: 3px; padding: 8px 4px; margin: -6px -2px -6px -4px; cursor: grab; touch-action: none; }
.pchip .grip i { display: block; width: 14px; height: 3px; border-radius: 2px; background: var(--soft); }
.pchip.lifted { opacity: .35; outline: 2px dashed var(--gold); outline-offset: 2px; }
.chipghost { position: fixed !important; left: 0; top: 0; z-index: 90; pointer-events: none; box-shadow: var(--shadow-3); opacity: .95; margin: 0; }
body.chipdragging, body.chipdragging * { cursor: grabbing !important; user-select: none; }
.draghint { margin: -2px 0 8px; }

/* ---------- the board games ---------- */
.bg-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; width: var(--sz); max-width: 100%; position: relative; }
.bg-pl {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px;
  background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px var(--line);
}
.bg-pl.turn { box-shadow: 0 0 0 3px var(--gold), 0 0 20px rgba(255,207,51,.4); }
.bg-name {
  display: inline-flex; align-items: center; gap: 6px; padding: .2em .8em; border-radius: 999px; max-width: 50%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: linear-gradient(var(--rk-hi), var(--rk)); color: var(--rk-text); font-family: var(--display); font-weight: 700; font-size: 1.05em;
}
.bg-name small { font-weight: 600; opacity: .75; }
.bg-name .ic { width: 1.1em; height: 1.1em; flex: none; }
.bg-extra { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; overflow: hidden; white-space: nowrap; }
.bg-turn { flex: none; padding: .15em .8em; border-radius: 999px; background: linear-gradient(var(--gold-hi), var(--gold)); color: #2a1f00; font-family: var(--display); font-weight: 700; font-size: .9em; }
.bg-cap { display: flex; flex-wrap: wrap; font-size: 1.35em; line-height: 1; }
.bg-cap .cp + .cp { margin-left: -.18em; }
.bg-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 3; padding: .3em 1em; border-radius: 999px;
  background: var(--gold); color: #2a1f00; font-family: var(--display); font-weight: 700; font-size: 1.3em; box-shadow: var(--shadow-3); opacity: .92;
}

.bg-board {
  position: relative; width: var(--sz); height: var(--sz); max-width: 100%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 6px #3b2614, 0 0 0 8px #241507, var(--shadow-3);
}
.bg-board .sq { position: relative; border: 0; padding: 0; margin: 0; display: grid; place-items: center; font: inherit; color: inherit; cursor: default; border-radius: 0; min-width: 0; min-height: 0; }
.bg-board .sq.lt { background: #f0dcb4; }
.bg-board .sq.dk { background: #a8714a; }
.bg-board.checkers .sq.dk { background: #3d6b4f; }
.bg-board.checkers .sq.lt { background: #eadcbd; }
.bg-board .sq.last::before { content: ''; position: absolute; inset: 0; background: rgba(255, 214, 51, .45); }
.bg-board .sq.can { cursor: pointer; }
.bg-board .sq.sel::before { content: ''; position: absolute; inset: 0; background: rgba(60, 200, 255, .45); box-shadow: inset 0 0 0 4px #1fa3ff; }
.bg-board .sq.to, .bg-board .sq.hit { cursor: pointer; }
.bg-board .sq.to::after { content: ''; position: absolute; width: 32%; height: 32%; border-radius: 50%; background: rgba(20, 120, 220, .75); box-shadow: 0 0 0 3px rgba(255,255,255,.75); }
.bg-board .sq.hit::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(230, 40, 30, .9); z-index: 2; }
.bg-board .sq.check { background: radial-gradient(circle, #ff3b2f 0 35%, #c4120a 75%) !important; }
.bg-board .sq:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; z-index: 2; }
.bg-board .sq .rk, .bg-board .sq .fl { position: absolute; font-style: normal; font-weight: 700; font-size: calc(var(--sz) * .022 + 4px); line-height: 1; opacity: .8; }
.bg-board .sq .rk { left: 3px; top: 3px; }
.bg-board .sq .fl { right: 3px; bottom: 2px; }
.bg-board .sq.lt .rk, .bg-board .sq.lt .fl { color: #8a5a36; }
.bg-board .sq.dk .rk, .bg-board .sq.dk .fl { color: #f6e6c6; }

/* chess pieces: the solid shapes in white or black, each outlined in the other color */
.cp { position: relative; z-index: 1; line-height: 1; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'DejaVu Sans', 'Apple Symbols', sans-serif; font-weight: 400; paint-order: stroke fill; }
.bg-board .cp { font-size: calc(var(--sz) / 8 * .8); pointer-events: none; }
.cp.w { color: #fff; -webkit-text-stroke: .05em #1a1a1a; text-shadow: 0 .04em .06em rgba(0,0,0,.45); }
.cp.b { color: #151515; -webkit-text-stroke: .045em #f4ead5; text-shadow: 0 .04em .06em rgba(0,0,0,.45); }
.bg-promo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; display: flex; gap: 8px; padding: 12px; border-radius: 18px;
  background: linear-gradient(180deg, var(--glass-hi), var(--glass)); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
}
.bg-promo button { width: calc(var(--sz) / 6); height: calc(var(--sz) / 6); border-radius: 14px; border: 0; background: #f0dcb4; cursor: pointer; display: grid; place-items: center; padding: 0; }
.bg-promo button:hover { background: #ffe58a; }
.bg-promo .cp { font-size: calc(var(--sz) / 8); }

/* checkers pieces */
.ck {
  --c1: #ff5a4a; --c2: #c4180c; --rim: #7a0a03; position: relative; z-index: 1; width: 80%; height: 80%; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, var(--c1) 0 40%, var(--c2) 42% 50%, var(--c1) 52% 60%, var(--c2) 62%);
  box-shadow: 0 0 0 2px var(--rim), 0 3px 0 var(--rim), 0 5px 8px rgba(0,0,0,.5);
  pointer-events: none;
}
.ck.b { --c1: #fbf6ea; --c2: #d8cdb0; --rim: #6c6247; }
.ck.king b { font-size: calc(var(--sz, 300px) / 8 * .42); line-height: 1; font-weight: 400; color: var(--gold); -webkit-text-stroke: 1.5px #3a2a00; paint-order: stroke fill; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'Apple Symbols', sans-serif; }
.ck.b.king b { color: #e0a000; }
.bg-board.mine .sq.can .ck { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold); }
.ck.mini { display: inline-block; width: 1.05em; height: 1.05em; flex: none; box-shadow: 0 0 0 1.5px var(--rim); }

/* mancala */
.bg-wrap.mc { width: var(--bw); }
.mc-board {
  --u: calc(var(--bw) / 8.6); position: relative; width: var(--bw); max-width: 100%; height: calc(var(--u) * 3.2); display: grid;
  grid-template-columns: calc(var(--u) * 1.1) 1fr calc(var(--u) * 1.1); grid-template-rows: 1fr 1fr; gap: calc(var(--u) * .16) calc(var(--u) * .14);
  padding: calc(var(--u) * .22); border-radius: calc(var(--u) * .7);
  background: linear-gradient(180deg, #b77a45, #8a5328); box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.25), var(--shadow-3);
}
.mc-board .store:first-child { grid-column: 1; grid-row: 1 / 3; }
.mc-board .store:last-child { grid-column: 3; grid-row: 1 / 3; }
.mc-row { grid-column: 2; display: grid; grid-template-columns: repeat(6, 1fr); gap: calc(var(--u) * .14); }
.mc-row.top { grid-row: 1; }
.mc-row.bot { grid-row: 2; }
.pit, .store {
  position: relative; border: 0; padding: 0; border-radius: 50%; color: #fff; font: inherit; min-width: 0;
  background: radial-gradient(ellipse at 50% 40%, #4a2a10, #6b3f1c 70%, #7d4c24); box-shadow: inset 0 calc(var(--u) * .06) calc(var(--u) * .12) rgba(0,0,0,.6);
}
.store { border-radius: calc(var(--u) * .55); }
.pit { cursor: default; }
.pit.can { cursor: pointer; box-shadow: inset 0 calc(var(--u) * .06) calc(var(--u) * .12) rgba(0,0,0,.6), 0 0 0 3px var(--gold), 0 0 16px rgba(255,207,51,.6); }
.pit.can:hover { transform: translateY(-2px); }
.pit:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.pit.from { box-shadow: inset 0 calc(var(--u) * .06) calc(var(--u) * .12) rgba(0,0,0,.6), 0 0 0 3px rgba(255,255,255,.6); }
.pit.to, .store.to { box-shadow: inset 0 calc(var(--u) * .06) calc(var(--u) * .12) rgba(0,0,0,.6), 0 0 0 3px #5ad1ff, 0 0 16px rgba(90,209,255,.6); }
.heap { position: absolute; inset: 14%; pointer-events: none; }
.seed {
  position: absolute; width: calc(var(--u, 40px) * .17); height: calc(var(--u, 40px) * .17); border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.6) 0 18%, transparent 24%), var(--sd, #5ec2ff); box-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.seed.s0 { --sd: #4fb5ff; }
.seed.s1 { --sd: #ff6b8a; }
.seed.s2 { --sd: #7be27b; }
.seed.s3 { --sd: #ffd84a; }
.seed.s4 { --sd: #c591ff; }
.pit .n, .store .n {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 45%); z-index: 2; min-width: 1.8em; padding: .05em .45em; border-radius: 999px;
  background: #fff; color: #111; font-family: var(--display); font-weight: 700; font-size: calc(var(--u) * .3); line-height: 1.2; box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.mc-row.top .pit .n { bottom: auto; top: 0; transform: translate(-50%, -45%); }
.store .n { bottom: 50%; transform: translate(-50%, 50%); font-size: calc(var(--u) * .42); }
.open30 .seed { position: static; transform: none; width: .8em; height: .8em; display: inline-block; }
.open30.bgside { background: rgba(0,0,0,.72); color: #fff; gap: 5px; }
.open30.bgside .cp { font-size: 1.2em; }

/* the end of a board game: why it ended */
.endwhy { text-align: center; margin: -6px 0 12px; color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 1.15em; }

/* the game chooser's pictures for the board games */
.gart .artsq { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; background: #a8714a; box-shadow: var(--shadow-1); font-size: 30px; }
.gart .artsq.lt { background: #f0dcb4; }
.gart .ck { width: 38px; height: 38px; flex: none; --sz: 300px; }
.gart .ck.king b { font-size: 18px; }
.gart .artpit { position: relative; width: 38px; height: 38px; border-radius: 50%; --u: 60px; background: radial-gradient(ellipse at 50% 40%, #4a2a10, #6b3f1c 70%, #7d4c24); box-shadow: 0 0 0 4px #9a6334; }
.gart .artpit .seed:nth-child(1) { left: 40%; top: 40%; }
.gart .artpit .seed:nth-child(2) { left: 62%; top: 55%; }
.gart .artpit .seed:nth-child(3) { left: 38%; top: 66%; }
.gart .artpit .seed:nth-child(4) { left: 60%; top: 32%; }
.gart.small .artsq, .gart.small .ck, .gart.small .artpit { width: 30px; height: 30px; font-size: 22px; }

/* ---------- rock paper scissors on the side ---------- */
.rpsico { font-size: 1.25em; line-height: 1; }
.rpsbox { width: min(380px, calc(100vw - 24px)); z-index: 45; }
.rpsbody { padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.rpslist { display: flex; flex-direction: column; gap: 6px; }
.rpswho { justify-content: flex-start; gap: 10px; width: 100%; }
.rpswho .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--rk); box-shadow: 0 0 0 2px rgba(255,255,255,.4); flex: none; }
.rpswho span { margin-left: auto; display: inline-flex; }
.rpspicks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rpspick {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; cursor: pointer; color: #fff;
  border: 2px solid var(--line-strong); background: rgba(255,255,255,.08); font-family: var(--display); font-size: 1em;
}
.rpspick:hover { border-color: var(--gold); background: rgba(255,207,51,.14); transform: translateY(-2px); }
.rpspick:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.rpshand { font-size: 46px; line-height: 1.1; display: inline-block; }
.rpshand.wait { width: 1.2em; text-align: center; color: var(--soft); font-family: var(--display); font-weight: 700; animation: armed .6s ease-in-out infinite alternate; }
.rpshand.win { animation: cup .5s cubic-bezier(.2,1.5,.4,1) both; filter: drop-shadow(0 0 10px var(--gold)); }
.rpshand.lose { opacity: .45; transform: scale(.85); }
.rpsvs { display: flex; align-items: center; justify-content: center; gap: 18px; }
.rpsvs .vs { color: var(--soft); font-family: var(--display); font-weight: 700; }
.rpsmsg { margin: 0; text-align: center; font-family: var(--display); font-weight: 600; font-size: 1.1em; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.rpsres { margin: 0; text-align: center; font-family: var(--display); font-weight: 700; font-size: 1.6em; }
.rpsres.won { color: var(--gold-hi); }
.rpsres.lost { color: #ffb4ae; }
.rpsscore { margin: 0; text-align: center; color: var(--muted); }
.rpsscore b { color: #fff; font-size: 1.2em; }
.rpsacts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.rpsno { align-self: center; }

@media (prefers-reduced-motion: reduce) {
  .rpshand.wait, .rpshand.win { animation: none; }
}
@media (max-width: 640px) {
  .rpshand { font-size: 36px; }
  .bg-name { font-size: .95em; }
  .bg-pl { min-height: 38px; }
}

/* tapping someone's face during Number Tiles: rock paper scissors with them */
body.rps-ok .seat:not(.me):not(.off) { cursor: pointer; }
body.rps-ok .seat:not(.me):not(.off):hover .face { box-shadow: 0 0 0 3px var(--gold); }
.seatmenu { position: fixed; z-index: 60; padding: 6px; border-radius: 16px; }
.seatmenu .btn { gap: 10px; white-space: nowrap; }
.seatmenu .rpsico { font-size: 1.1em; letter-spacing: -.1em; }
.seatmenu { display: flex; flex-direction: column; gap: 6px; }
.seatmenu .btn { justify-content: flex-start; }

/* ---------- joining: your name, a nickname, open lobbies ---------- */
.profsel {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line-strong); cursor: pointer;
  background: rgba(0,0,0,.3); color: #fff; font-family: var(--display); font-weight: 600; font-size: 1.15em;
}
.profsel:focus { border-color: var(--gold); outline: none; }
.profsel option { background: #0b2a1d; color: #fff; }
.joinbox label .opt { font-weight: 400; color: var(--soft); }
.openlobbies { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 10px; border-radius: 14px; background: rgba(255,207,51,.08); border: 1px solid rgba(255,207,51,.35); }
.openlobbies[hidden] { display: none; }
.openlobbies .olabel { font-family: var(--display); font-weight: 600; font-size: .95em; color: var(--gold-hi); }
.olobby {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 2px solid var(--line-strong); background: rgba(255,255,255,.07); color: #fff; font: inherit;
}
.olobby:hover { border-color: var(--gold); background: rgba(255,207,51,.12); }
.olobby:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.olobby b { font-family: var(--display); font-size: 1.15em; color: var(--gold-hi); }
.olobby span { flex: 1; min-width: 0; color: var(--muted); font-size: .9em; }
.olobby .ic { flex: none; color: var(--gold); }

/* the custom color swatch: a color picker in swatch clothing */
.swatches.row8 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.swatch.custom { position: relative; cursor: pointer; margin: 0; font: inherit; color: inherit; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch.custom:not(.on) .sw-top { background: conic-gradient(#e3262a, #f7c600, #25a84e, #2472e6, #9257ff, #ff6eb6, #e3262a); display: grid; place-items: center; color: #fff; font-weight: 700; text-shadow: 0 1px 2px #000; }
.swatch.custom:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.listrow { margin-top: 6px; }

/* ---------- lifetime stats ---------- */
.lifemodal { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); }
.lifemodal[hidden] { display: none; }
.lifecard { width: min(1100px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 8px 18px 16px; }
.lifewrap { overflow-x: auto; margin: 10px 0 6px; }
.lifetable { border-collapse: separate; border-spacing: 0 4px; width: 100%; min-width: 760px; font-variant-numeric: tabular-nums; }
.lifetable th, .lifetable td { padding: 8px 10px; text-align: center; white-space: nowrap; }
.lifetable thead th { font-size: .78em; letter-spacing: .05em; text-transform: uppercase; color: var(--soft); font-weight: 700; white-space: normal; }
.lifetable tbody tr { background: rgba(255,255,255,.06); }
.lifetable tbody th { text-align: left; font-family: var(--display); font-size: 1.1em; border-radius: 10px 0 0 10px; }
.lifetable tbody td:last-child { border-radius: 0 10px 10px 0; }
.lifetable tbody tr.me { background: rgba(255,207,51,.14); }
.lifetable tbody tr.me th { color: var(--gold-hi); }
.lifetable td b { font-size: 1.2em; }
.lifetable td small { color: var(--muted); }
.lifetable td i { display: block; font-style: normal; font-size: .75em; color: var(--soft); }
.lifetable td em { display: block; font-style: normal; font-size: .8em; font-weight: 700; }
.lifetable td em.up { color: #7ee2a2; }
.lifetable td em.down { color: #ffb4ae; }
.lifetable td.none { color: var(--soft); }
.lifetable td:nth-child(2) { background: rgba(0,0,0,.15); }

/* ---------- whispers ---------- */
.wbox { width: min(400px, calc(100vw - 24px)); z-index: 46; display: flex; flex-direction: column; }
/* on wider screens the whisper box sits on the left, so it never covers rock paper scissors (top right) */
@media (min-width: 860px) { .wbox { right: auto; left: 12px; } }
.popover.front { z-index: 47; }
.wbox .pophead b { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wbox .pophead .turnchip { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wthread { display: flex; flex-direction: column; gap: 6px; max-height: min(320px, 42vh); overflow-y: auto; padding: 10px 2px; }
.wthread .fieldhint { margin: 4px 0; }
.wmsg {
  align-self: flex-start; max-width: 85%; padding: .45em .8em; border-radius: 16px 16px 16px 4px; background: rgba(255,255,255,.14);
  font-size: 1.05em; line-height: 1.3; overflow-wrap: anywhere;
}
.wmsg.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: linear-gradient(var(--gold-hi), var(--gold)); color: #2a1f00; }
.wform { display: flex; gap: 8px; }
.wform input {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line-strong);
  background: rgba(0,0,0,.3); color: #fff; font: inherit; font-size: 1.05em;
}
.wform input:focus { border-color: var(--gold); outline: none; }
#wNote { position: fixed; left: 0; right: 0; top: 70px; z-index: 79; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
#wNote[hidden] { display: none; }
.wn-card {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: 100%; padding: 10px 10px 10px 14px; border-radius: 18px;
  background: linear-gradient(180deg, var(--glass-hi), var(--glass)); border: 3px solid var(--rk); box-shadow: var(--shadow-3);
  animation: alin .4s cubic-bezier(.2, 1.5, .4, 1) both;
}
.wn-ico { font-size: 1.8em; line-height: 1; }
.wn-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wn-txt b { font-family: var(--display); color: var(--gold-hi); }
.wn-txt span { font-size: 1.1em; overflow-wrap: anywhere; }
