/* The games: lobby, tables, seats, the full-screen game, and the game-over moment. Loaded after theme.css and before dark.css. */

/* ---- the games page ---- */
.gm-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 20px; margin-bottom: 16px; border-radius: 26px; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgba(255,182,72,.5), transparent 45%), linear-gradient(140deg, #2b1458, #5b34d6 55%, #0f9a6f); box-shadow: var(--shadow-md); }
.gm-hero h1 { color: #fff; margin: 0 0 4px; }
.gm-hero p { margin: 0; opacity: .9; font-size: 14.5px; max-width: 420px; }
.gm-hero-ic { font-size: 56px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.3)); animation: hero-tilt 3.5s ease-in-out infinite; }
@keyframes hero-tilt { 50% { transform: rotate(-12deg) translateY(-4px); } }
.gm-group.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--brand); } 100% { box-shadow: var(--shadow-sm); } }
.gm-start { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.gm-new { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 18px; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: transform .12s, box-shadow .15s; }
.gm-new:hover { box-shadow: var(--shadow-sm); }
.gm-new:active { transform: scale(.96); }
.gm-new .gm-ic { font-size: 34px; line-height: 1; margin-bottom: 6px; transition: transform .2s; }
.gm-new:hover .gm-ic { transform: rotate(-8deg) scale(1.08); }
.gm-ludo { background: linear-gradient(135deg, #ffe3dd, #fff4cf); } .gm-whot { background: linear-gradient(135deg, #f6dbe2, #fdeef1); }
.gm-chess { background: linear-gradient(135deg, #dff1e6, #eef8f1); } .gm-draughts { background: linear-gradient(135deg, #f3e4cf, #fbf1e3); }
.gm-list { margin-top: 12px; display: grid; gap: 8px; }
.gm-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; width: 100%; }
.gm-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gm-row .row-dot { font-size: 11px; padding: 0 9px; flex: none; }
.gm-join { background: var(--brand) !important; }
.mini-avs { display: flex; flex: none; }
.mini-av { width: 24px; height: 24px; border-radius: 50%; margin-left: -6px; background: var(--c); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--card); }
.gm-past { margin-top: 10px; }
.gm-past summary { cursor: pointer; font-size: 13.5px; color: var(--muted); min-height: 32px; }
.gm-past .gm-row { margin-top: 6px; opacity: .85; }

/* ---- sheets: new game, how to play ---- */
.gm-sheet .more-panel { padding: 14px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.gm-sheet h2 { margin: 4px 0 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.seg button { flex: 1; min-width: 48px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--grad-btn); border-color: transparent; color: #fff; }
.gm-rules ol { padding-left: 20px; line-height: 1.6; }
.gm-rules li { margin-bottom: 8px; }

/* ---- the full-screen game ---- */
body.game-open { overflow: hidden; }
@media (max-width: 700px) { body.game-open .sidebar { display: none; } body.game-open .app { padding-bottom: 0; } }
body.game-open .content { padding: 0; max-width: none; }
.gm-screen { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(14px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 0%, #1f5f4a 0%, #0f3a2e 55%, #0a2a21 100%); color: #f1f6f3; overflow-y: auto; }
.gm-k-whot { background: radial-gradient(ellipse at 50% 30%, #6a1b2c 0%, #3d0f1a 60%, #26070f 100%); }
.gm-k-chess { background: radial-gradient(ellipse at 50% 0%, #3a3f52 0%, #1d2030 60%, #121420 100%); }
.gm-k-draughts { background: radial-gradient(ellipse at 50% 0%, #5c3a22 0%, #36210f 60%, #211307 100%); }
.gm-screen .muted { color: rgba(241,246,243,.72); }
.gm-top { display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 10px 6px 4px; }
.gm-top .chat-back { color: #fff; }
.gm-top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-top-title strong { font-size: 17px; }
.gm-top-title span { font-size: 12.5px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-tool { width: 40px; height: 40px; min-height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font: inherit; font-weight: 800; font-size: 17px; cursor: pointer; }
.gm-seats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.seat { position: relative; flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 30px; background: rgba(255,255,255,.08); border: 1.5px solid transparent; transition: background .2s, border-color .2s; }
.seat.turn { background: rgba(255,255,255,.18); border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent), 0 0 18px color-mix(in srgb, var(--c) 55%, transparent); }
.seat.gone { opacity: .4; text-decoration: line-through; }
.seat-av { width: 34px; height: 34px; border-radius: 50%; background: var(--c, #8a9a94); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); flex: none; }
.seat.me .seat-av { box-shadow: 0 0 0 2px #fff, inset 0 -3px 0 rgba(0,0,0,.18); }
.seat-txt { display: flex; flex-direction: column; line-height: 1.15; }
.seat-txt b { font-size: 13.5px; } .seat-txt small { font-size: 11.5px; opacity: .75; }
.seat-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: #ffd64f; box-shadow: 0 0 0 2px #0f3a2e; animation: pulse-dot 1.1s ease-in-out infinite; }
@keyframes pulse-dot { 50% { transform: scale(1.35); } }
.gm-screen .gm-status { margin: 4px 12px 10px; background: rgba(255,255,255,.1); color: #fff; font-size: 14px; }
.gm-screen .gm-status.mine { background: linear-gradient(135deg, #ffd64f, #ffb648); color: #3b2a00; box-shadow: 0 6px 18px -6px rgba(255,182,72,.7); }
.gm-screen .gm-status.over { background: rgba(255,255,255,.14); color: #fff; }
.gm-stage { position: relative; padding: 0 12px; }
.gm-actions { display: flex; justify-content: space-between; align-items: center; margin: 12px 16px 0; }
.gm-actions .btn-link { color: rgba(255,255,255,.75); }
.gm-tip { margin: 10px 14px 0; text-align: center; }
#gm-pick .gm-promo { margin: 12px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.12); }
#gm-pick .gm-promo span { width: 100%; text-align: center; font-weight: 700; }
#gm-pick .btn-outline { background: #fff; color: #10211d; }

/* the big announcement bubble: "Pick two!", "Last card!", "Captured!" */
.gm-bubble { position: absolute; left: 50%; top: 38%; z-index: 5; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap;
  padding: 12px 22px; border-radius: 30px; background: #ffd64f; color: #3b2a00; font-weight: 900; font-size: 22px; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.gm-bubble.show { animation: bubble 1.8s cubic-bezier(.2,.9,.3,1.2); }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 25%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.95); } }

/* ---- lobby ---- */
.lobby { margin: 10px 4px; padding: 24px 18px; border-radius: 26px; background: rgba(255,255,255,.08); text-align: center; }
.lobby-ic { font-size: 64px; animation: hero-tilt 3s ease-in-out infinite; }
.lobby h2 { color: #fff; margin: 6px 0; }
.lobby-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 16px 0; }
.lobby-seat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 18px; background: rgba(255,255,255,.1); }
.lobby-seat .seat-av { width: 46px; height: 46px; font-size: 18px; background: var(--brand); }
.lobby-seat.free { border: 2px dashed rgba(255,255,255,.25); background: transparent; }
.lobby-seat.free .seat-av { background: rgba(255,255,255,.12); color: rgba(255,255,255,.6); }
.lobby-seat small { font-size: 11px; opacity: .7; }
.lobby-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 8px; }
.gm-screen .btn-outline { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.3); }
.gm-screen .btn-link { color: rgba(255,255,255,.8); }

/* ---- game over ---- */
.gm-over { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5,15,12,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: page-in .3s ease-out; }
.gm-over-card { position: relative; z-index: 1; width: 100%; max-width: 360px; padding: 26px 20px 18px; border-radius: 28px; background: var(--card); color: var(--ink); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.gm-over-card .muted { color: var(--muted); }
.gm-over-card .btn-outline { background: var(--surface2, #f3f6f3); color: var(--ink); border-color: var(--border); }
.gm-over-card .btn-link { color: var(--brand-dark); }
.gm-over-face { font-size: 64px; line-height: 1; animation: pop .6s ease-out; }
.gm-over h2 { margin: 10px 0 4px; font-size: 26px; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; left: calc(var(--i) * 4.2%); width: 9px; height: 14px; border-radius: 2px; background: hsl(calc(var(--i) * 47), 85%, 60%); animation: fall calc(2.2s + (var(--i) * .07s)) linear calc(var(--i) * -.13s) infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confetti, .gm-hero-ic, .lobby-ic, .seat-dot { animation: none !important; display: none; } .gm-bubble.show { animation-duration: .01ms; opacity: 1; } }

/* ---- chess and draughts on the table ---- */
.gm-screen .gboard { box-shadow: 0 0 0 8px #3b2a1a, 0 0 0 10px #6b4a2a, 0 18px 40px rgba(0,0,0,.5); border-radius: 6px; }
.sq.check { box-shadow: inset 0 0 0 100px rgba(229,72,45,.55); }
.sq .rk, .sq .fl { position: absolute; font-size: 9px; font-weight: 800; opacity: .55; pointer-events: none; }
.sq .rk { top: 2px; left: 3px; } .sq .fl { bottom: 1px; right: 3px; }
.chess .sq.lt .rk, .chess .sq.lt .fl { color: #6f9e74; } .chess .sq.dk .rk, .chess .sq.dk .fl { color: #eeeed2; }
.taken { display: flex; justify-content: space-between; max-width: 440px; margin: 0 auto 8px; min-height: 22px; font-size: 18px; letter-spacing: -2px; opacity: .85; }

/* ---- ludo on the table ---- */
.ludo-wrap { padding: 6px; border-radius: 20px; background: linear-gradient(145deg, #f5e6c8, #d9bf8f); box-shadow: 0 18px 40px rgba(0,0,0,.45); max-width: 452px; margin: 0 auto; }
.gm-screen .ludo { box-shadow: none; }
.yard.idle { filter: grayscale(.7) brightness(.85); opacity: .55; }
.yard.now { animation: yard-glow 1.4s ease-in-out infinite; }
@keyframes yard-glow { 50% { filter: brightness(1.18) saturate(1.2); } }
.lc.landed { animation: landed .6s ease-out; }
@keyframes landed { 0% { box-shadow: inset 0 0 0 100px rgba(255,214,79,.9); } 100% { box-shadow: inset 0 0 0 .5px rgba(0,0,0,.12); } }
.dice { --c: #0a6b52; }
.gm-screen .dice { background: rgba(255,255,255,.12); color: #fff; min-width: 120px; }
.gm-screen .dice.can { background: var(--c); color: #fff; box-shadow: 0 0 0 3px #fff, 0 10px 24px rgba(0,0,0,.45); }
.gm-screen .ludo-bar { justify-content: center; }
.tok-g { background: radial-gradient(circle at 35% 30%, #7fe0a5, #1d8a49); }
.tok-b { background: radial-gradient(circle at 35% 30%, #8fbaff, #1f5fc0); }

/* ---- whot on the table ---- */
.gm-screen .w-table { background: radial-gradient(circle at 50% 40%, #2a8a5f, #10533a); border: 6px solid #5b3a1e; box-shadow: inset 0 2px 12px rgba(0,0,0,.4), 0 14px 30px rgba(0,0,0,.4); }
.w-pen { color: #3b2a00; background: #ffd64f; font-weight: 900; font-size: 13px; padding: 3px 12px; border-radius: 10px; animation: pulse-dot 1.2s ease-in-out infinite; }
.gm-screen .w-ask { background: rgba(0,0,0,.35); }
.w-hand { padding: 18px 8px 10px; justify-content: center; }
@media (max-width: 520px) {
  .w-hand { justify-content: flex-start; }
  .w-hand .wcard { margin-left: -18px; }
  .w-hand .wcard:first-child { margin-left: 0; }
}
.w-hand .wcard { transition: transform .18s, box-shadow .18s; }
.w-hand .wcard.can:hover { transform: translateY(-14px); }
.w-mine .muted b { color: #ffd64f; }
.gm-screen .wcard:not(.can):not(.back):not(.big) { opacity: .5; filter: saturate(.6); }
.w-pile .wcard.big { animation: card-in .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes card-in { from { transform: translateY(-30px) rotate(-8deg) scale(.85); opacity: .3; } to { transform: none; opacity: 1; } }

/* dark mode adjustments for the light parts */
:root[data-mode="dark"] .gm-ludo, :root[data-mode="dark"] .gm-whot, :root[data-mode="dark"] .gm-chess, :root[data-mode="dark"] .gm-draughts { background: var(--surface2); }
:root[data-mode="dark"] .seg button { background: var(--surface2); }
