/* KHABEETHA: the card room on the site's shared design. tokens.css names every colour, text size, weight, corner, shadow
   and layer; ui.css brings the buttons (.gk-btn), pop-ups (dialog.gk-pop), choice tiles (.gk-seg) and the side menu
   (dialog.gk-menu); game.css makes the page one screen high. Only the cards (faces, backs, suits) keep colours of their
   own, below. Sizes come from a few custom properties and container-query units, so the script never measures layout
   (except the table, which app.js lays out). */
:root {
  /* The cards: white faces with red, black and purple (joker) ink, and navy backs. */
  --card: var(--gk-white); --card2: #eef1f6; --card-edge: #c9d1e0; --card-ink: #141b2b; --card-red: #d3262f; --card-purple: #6b3fa6;
  --joker-face: #fbf6ff; --joker-face2: #ebdcf6; --joker-edge: #b094d3; --joker-glow: #b48cff88;
  --back: #1b2f63; --back2: #26427f; --back-dot: #5a7fd0; --back-edge: #e8eefc;
  /* Hand card width: fits 8 overlapping cards across a phone, never taller than the screen allows. */
  --hw: min(15.5vw, 9.6dvh, 88px);
  /* Avatars shrink on a short screen; the piles never go under a finger's width. */
  --av: clamp(40px, min(12.5vw, 6.6dvh), 60px);
  --pw: clamp(44px, 11.5vw, 62px);
}
body { -webkit-tap-highlight-color: transparent; }

/* ---------- Page: the site's bar (on the site), then the table, which takes the rest of the screen ---------- */
html.gk-bar header.topbar { position: static; }
.game { flex: 1 1 0; min-height: 0; width: 100%; max-width: 1000px; margin: 0 auto; position: relative; direction: ltr;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 4px;
  padding: 6px max(8px, var(--gk-safe-end)) max(6px, var(--gk-safe-bottom)) max(8px, var(--gk-safe-start)); }
/* Away from the site there is no bar above the table, so the table keeps clear of the notch itself. */
html:not(.gk-bar) .game { padding-top: max(8px, var(--gk-safe-top)); }

/* ---------- Top: the options gear, the player across the table, the scores ---------- */
/* On the site the bar's gear stands in for the table's own, which keeps its place so the row does not move. */
html.gk-bar .hud .gear { visibility: hidden; }
.hud { display: grid; grid-template-columns: 64px 1fr 100px; align-items: start; gap: 6px; min-height: calc(var(--av) + 40px); }
.gear { width: 52px; height: 52px; margin-top: 6px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--gk-gold);
  background: radial-gradient(circle at 35% 30%, var(--gk-rim-light), var(--gk-panel-deep)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gk-gold-deep) 53%, transparent), var(--gk-shadow-2); }
.scorebox { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; background: none; border: 0; }
.scoremini { position: relative; width: 92px; height: 84px; border-radius: var(--gk-r-md); background: color-mix(in srgb, var(--gk-well) 90%, transparent); border: 2px solid var(--gk-gold-deep); box-shadow: var(--gk-shadow-2); }
.scoremini::before { content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; translate: -50% -50%; border-radius: var(--gk-r-md); background: var(--gk-tile); box-shadow: var(--gk-inset); }
.sb-b { position: absolute; z-index: 1; min-width: 30px; height: 20px; padding: 0 5px; border-radius: var(--gk-r-pill); display: grid; place-items: center;
  font: var(--gk-number) var(--gk-text-xs)/1 var(--gk-font); color: var(--gk-white); background: color-mix(in srgb, var(--gk-muted) 45%, var(--gk-well)); box-shadow: var(--gk-shadow-1); }
.sb-b.good { background: var(--gk-go); } .sb-b.bad { background: var(--gk-leave); }
.sb-b[data-pos=north] { top: 5px; left: 50%; transform: translateX(-50%); }
.sb-b[data-pos=south] { bottom: 5px; left: 50%; transform: translateX(-50%); }
.sb-b[data-pos=west] { left: 3px; top: 50%; transform: translateY(-50%); }
.sb-b[data-pos=east] { right: 3px; top: 50%; transform: translateY(-50%); }
.roundlbl { padding: 2px 8px; border-radius: var(--gk-r-sm); border: 1px solid var(--gk-line); background: color-mix(in srgb, var(--gk-well) 90%, transparent); color: var(--gk-white); font-size: var(--gk-text-xs); white-space: nowrap; unicode-bidi: plaintext; }

/* ---------- Players: an avatar in the player's colour over a name plate ---------- */
/* --seat is the player's colour by seat number (data-col), the same on every screen. */
.seat { --seat: var(--gk-seat-1); display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
:is(.seat, .meld)[data-col=red] { --seat: var(--gk-seat-2); } :is(.seat, .meld)[data-col=green] { --seat: var(--gk-seat-3); } :is(.seat, .meld)[data-col=yellow] { --seat: var(--gk-seat-4); }
.hud .seat { justify-self: center; padding-top: 10px; }
.avwrap { position: relative; width: var(--av); height: var(--av); }
.avatar { position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--gk-white); display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--seat) 70%, var(--gk-panel-deep)), var(--gk-well) 85%); box-shadow: var(--gk-shadow-2);
  font-size: calc(var(--av) * .46); color: var(--gk-white); text-shadow: 0 2px 4px var(--gk-dark); }
/* The player's own face (shared/faces.js) fills the circle; their suit sits on it as a badge in their colour. */
.avatar > .gk-avatar { position: absolute; inset: 0; width: 100%; height: 100%; font-size: inherit; text-shadow: none; }
.avatar > .suit { position: absolute; z-index: 3; left: -6px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: var(--gk-text-xs); line-height: 1; background: var(--seat); color: var(--gk-white); border: 2px solid var(--gk-white); text-shadow: 0 1px 2px var(--gk-dark); }
.seat.active .avatar { box-shadow: 0 0 0 3px var(--seat), 0 0 22px var(--seat), var(--gk-shadow-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.15); } }
/* Turn timer ring */
.avwrap::after { content: ""; position: absolute; inset: -7px; z-index: 2; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity var(--gk-slow);
  background: conic-gradient(var(--gk-gold) calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), var(--gk-night) calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), var(--gk-night) calc(100% - 3px)); }
.seat.active.timed .avwrap::after { opacity: 1; }
.tbadge { position: absolute; z-index: 3; top: -8px; right: -10px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: var(--gk-r-pill); display: none; place-items: center;
  font: var(--gk-number) var(--gk-text-xs)/1 var(--gk-font); background: var(--gk-gold); color: var(--gk-on-gold); box-shadow: var(--gk-shadow-1); }
.seat.active.timed .tbadge { display: grid; }
.tbadge.urgent { background: var(--gk-leave); color: var(--gk-white); animation: tick .8s ease-in-out infinite; }
@keyframes tick { 50% { transform: scale(1.15); } }
/* Fanned card backs show that a player still holds cards */
.fan { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.fan i { position: absolute; left: 50%; top: -4px; width: calc(var(--av) * .42); height: calc(var(--av) * .6); margin-left: calc(var(--av) * -.21); border-radius: calc(var(--av) * .08);
  border: 2px solid var(--back-edge); background: repeating-linear-gradient(45deg, var(--back) 0 4px, var(--back2) 4px 8px); box-shadow: var(--gk-shadow-1); transform-origin: 50% 140%; }
.fan i:nth-child(1) { transform: rotate(-34deg) translateY(-10px); }
.fan i:nth-child(2) { transform: rotate(-12deg) translateY(-14px); }
.fan i:nth-child(3) { transform: rotate(12deg) translateY(-14px); }
.fan i:nth-child(4) { transform: rotate(34deg) translateY(-10px); }
.count { position: absolute; z-index: 3; left: -8px; top: -6px; min-width: 22px; height: 22px; padding: 0 4px; border-radius: var(--gk-r-pill); display: grid; place-items: center;
  font: var(--gk-number) var(--gk-text-xs)/1 var(--gk-font); background: var(--gk-well); border: 2px solid var(--seat); color: var(--gk-white); }
.okbadge { position: absolute; z-index: 3; right: -5px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: var(--gk-bold) var(--gk-text-xs)/1 var(--gk-font); background: var(--gk-go); color: var(--gk-white); border: 2px solid var(--gk-white); }
.dealer { position: absolute; z-index: 3; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); padding: 4px 7px; border-radius: var(--gk-r-pill);
  font: var(--gk-bold) var(--gk-text-xs)/1 var(--gk-font); background: var(--gk-join); color: var(--gk-white); white-space: nowrap; box-shadow: var(--gk-shadow-1); unicode-bidi: plaintext; }
.seat[data-pos=east] .dealer { left: auto; right: calc(100% + 6px); }
/* The name plate is the site's player plate (.gk-seat): navy, a thin edge in the player's colour while it is their turn. */
.nameplate { max-width: 120px; padding: 2px 8px; border-radius: var(--gk-r-sm); border: 1px solid var(--gk-line); background: color-mix(in srgb, var(--gk-well) 85%, transparent);
  text-align: center; line-height: 1.25; transition: border-color var(--gk-move); }
.seat.active .nameplate { border-color: var(--seat); }
.nameplate b { display: block; font-size: var(--gk-text-xs); font-weight: var(--gk-bold); color: var(--gk-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.nameplate small { display: block; font-size: var(--gk-text-xs); color: var(--gk-muted); white-space: nowrap; unicode-bidi: plaintext; }
.nameplate small.ok { color: var(--gk-good); }
.peek { max-width: 150px; padding: 3px 6px; border-radius: var(--gk-r-sm); background: var(--gk-well); color: var(--gk-info); font-size: var(--gk-text-xs); word-break: break-word; }

/* ---------- Table ---------- */
.table { min-height: 0; display: grid; grid-template-columns: calc(var(--av) + 4px) minmax(0, 1fr) calc(var(--av) + 4px); align-items: center; position: relative; }
.game[data-players="2"] .table { grid-template-columns: 0 minmax(0, 1fr) 0; }
.game[data-players="2"] .seat[data-pos=west], .game[data-players="2"] .seat[data-pos=east] { display: none; }
.table .seat { z-index: 3; }
.table .seat[data-pos=west] { grid-column: 1; grid-row: 1; margin-right: calc(var(--av) * -.55); }
.table .seat[data-pos=east] { grid-column: 3; grid-row: 1; margin-left: calc(var(--av) * -.55); }
/* Empty table before the first match: no players, cards, piles or scores */
.game.lobby :is(.seat, .hand, .tray, .melds, #return, .scorebox, .bar-left, .bar-right, #playHint, #viewing) { visibility: hidden; }
/* The felt in its dark rim. app.js sets the rows and columns (and --tc) so every group on it fits at one card size. */
.felt { --tc: 30px; grid-column: 2; grid-row: 1; position: relative; height: 100%; min-height: 0;
  border-radius: clamp(36px, 10vw, 80px); border: clamp(7px, 2vw, 12px) solid var(--gk-rim);
  background: radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--gk-felt) 86%, var(--gk-white)) 0, var(--gk-felt) 42%, var(--gk-felt-deep) 100%);
  box-shadow: 0 0 0 3px var(--gk-rim-light), 0 0 0 5px var(--gk-dark), inset 0 0 0 2px var(--gk-line-soft), inset 0 0 60px color-mix(in srgb, var(--gk-night) 55%, transparent), 0 18px 40px var(--gk-dark);
  display: grid; grid-template-areas: "n n n" "w c e" "s s s"; grid-template-columns: 0 minmax(0, 1fr) 0; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); padding: 12px; gap: 6px; }
.felt::before { content: ""; position: absolute; inset: 16% 14% 10%; border-radius: clamp(20px, 6vw, 46px); background: color-mix(in srgb, var(--gk-white) 3%, transparent); box-shadow: var(--gk-inset); pointer-events: none; }
.felt::after { content: "KHABEETHA"; position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; pointer-events: none;
  font: italic var(--gk-bold) clamp(var(--gk-text-lg), 4vw, var(--gk-text-3xl))/1 var(--gk-font); color: color-mix(in srgb, var(--gk-white) 6%, transparent); }
/* One group area per seat, on that player's side of the table. */
.melds[data-zone=north] { grid-area: n; } .melds[data-zone=west] { grid-area: w; } .melds[data-zone=east] { grid-area: e; } .melds[data-zone=south] { grid-area: s; }
.melds { position: relative; z-index: 1; min-width: 0; min-height: 0; }
.mz { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; overflow: auto; scrollbar-width: none; }
/* Narrow tables: the side areas turn so each side player's groups run along that player's edge, facing them. */
.felt.rot .melds[data-zone=west], .felt.rot .melds[data-zone=east] { container-type: size; }
.felt.rot .melds[data-zone=west] .mz, .felt.rot .melds[data-zone=east] .mz { inset: auto; left: 50%; top: 50%; width: 100cqh; height: 100cqw; overflow: visible; transform: translate(-50%, -50%) rotate(90deg); }
.felt.rot .melds[data-zone=east] .mz { transform: translate(-50%, -50%) rotate(-90deg); }
/* A group on the table, underlined in its owner's colour. */
.meld { --seat: var(--gk-seat-1); display: flex; gap: 1px; padding: 0 0 3px; border: 0; border-bottom: 3px solid var(--seat); border-radius: calc(var(--tc) * .14); background: none; cursor: pointer; transition: transform var(--gk-fast), filter var(--gk-fast); }
.meld:hover, .meld.drop { transform: translateY(-2px); filter: drop-shadow(0 0 6px var(--gk-gold)); }
.meld .card { width: var(--tc); height: calc(var(--tc) * 1.38); border-radius: calc(var(--tc) * .1); padding: 0; cursor: pointer; }
.meld .card .c { position: static; width: 100%; height: 100%; justify-content: center; }
.meld .card .c b { font-size: calc(var(--tc) * .56); }
.meld .card .c i { font-size: calc(var(--tc) * .5); }
.meld .card .p, .meld .card .c2 { display: none; }
.meld .card.joker-as .badge { font-size: max(5px, calc(var(--tc) * .17)); }
/* A room waiting for its players: the message on the felt. */
.waiting { align-self: center; white-space: pre-line; text-align: center; padding: 12px 16px; border-radius: var(--gk-r-md); border: 1px solid var(--gk-line);
  background: color-mix(in srgb, var(--gk-well) 70%, transparent); color: var(--gk-white); font-size: var(--gk-text-sm); line-height: var(--gk-read); unicode-bidi: plaintext; }

/* Centre tray: stock and discard. Its 16px side padding places the draw arrow over the stock. */
.center { grid-area: c; position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.tray { position: relative; display: flex; gap: 14px; padding: 10px 16px; border-radius: var(--gk-r-md); background: color-mix(in srgb, var(--gk-well) 80%, transparent); box-shadow: var(--gk-inset), var(--gk-shadow-2); }
.pile { position: relative; width: var(--pw); height: calc(var(--pw) * 1.4); padding: 0; border-radius: calc(var(--pw) * .1); display: grid; place-items: center; }
/* The piles are cards: when it is not your turn they stay as they are (game.css would fade a disabled button). */
.pile:disabled { opacity: 1; cursor: default; }
.pile.stock { border: 3px solid var(--back-edge); color: var(--gk-white);
  background: radial-gradient(circle at 50% 50%, var(--back-dot) 0 13%, transparent 14%), radial-gradient(circle at 50% 50%, transparent 0 24%, color-mix(in srgb, var(--back-dot) 33%, transparent) 25% 28%, transparent 29%), repeating-linear-gradient(45deg, var(--back) 0 5px, var(--back2) 5px 10px);
  box-shadow: 2px 2px 0 var(--gk-muted), 4px 4px 0 var(--gk-rim), var(--gk-shadow-2); }
.pile.stock .n { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: var(--gk-r-pill); border: 1px solid var(--gk-muted); background: var(--gk-well); font: var(--gk-number) var(--gk-text-xs)/1 var(--gk-font); }
.pile.stock .rc { position: absolute; top: -8px; right: -8px; padding: 2px 5px; border-radius: var(--gk-r-pill); background: var(--gk-gold-deep); color: var(--gk-on-gold); font: var(--gk-number) var(--gk-text-xs)/1 var(--gk-font); }
.pile.discard { background: linear-gradient(145deg, var(--card), var(--card2)); color: var(--card-ink); border: 1px solid var(--card-edge); box-shadow: var(--gk-shadow-2); font-family: var(--gk-font); }
.pile.discard.red { color: var(--card-red); }
.pile.discard.joker { color: var(--card-purple); }
.pile.discard .c { position: absolute; top: 4px; left: 5px; display: flex; flex-direction: column; align-items: center; line-height: .95; }
.pile.discard .c b { font-size: calc(var(--pw) * .34 * var(--index, 1)); } .pile.discard .c i { font-style: normal; font-size: calc(var(--pw) * .28 * var(--index, 1)); }
.pile.discard .p { position: absolute; right: 6%; bottom: 6%; font-size: calc(var(--pw) * .62 * var(--pip, 1)); line-height: 1; }
/* A card-back skin (shared/cardart.js): its drawing on the stock, the fans and the dealt cards. */
html[data-back] :is(.pile.stock, .fan i, .dealcard) { background: var(--back-art) center / 100% 100% no-repeat; }
.pile.discard.empty { background: var(--gk-panel-deep); border: 1px dashed var(--gk-muted); color: var(--gk-muted); box-shadow: none; font-size: var(--gk-text-md); }
.pile.discard.drop { outline: 3px solid var(--gk-bad); outline-offset: 3px; transform: scale(1.1); }
/* Return the tried discard and draw from the stock instead: a small gold action under the piles. */
.retbtn { min-height: var(--gk-tap); padding: 6px 14px; font-size: var(--gk-text-sm); unicode-bidi: plaintext; }

/* Bouncing gold arrow hints (the gradient #gold is in index.html) */
.hint { width: 30px; height: 40px; filter: drop-shadow(0 3px 4px var(--gk-dark)); animation: bounce 1s ease-in-out infinite; pointer-events: none; }
.hint path { stroke: var(--gk-on-gold-soft); }
#gold stop { stop-color: var(--gk-gold-pale); } #gold stop + stop { stop-color: var(--gk-gold-warm); }
/* Above the stock; the table layout keeps this space free of cards. */
#drawHint { position: absolute; bottom: calc(100% - 6px); left: calc(16px + var(--pw) / 2 - 15px); z-index: 3; }
@keyframes bounce { 50% { transform: translateY(8px); } }
body.dragging .hint { display: none; }

/* Trash circle: the real drop zone around the discard pile while dragging */
.pilewrap { position: relative; display: grid; place-items: center; }
.pilewrap .pile { position: relative; z-index: 1; }
.trash { position: absolute; left: 50%; top: 50%; z-index: 0; width: 140px; height: 140px; border-radius: 50%; transform: translate(-50%, -50%) scale(.8); opacity: 0; pointer-events: none; color: var(--gk-shine);
  border: 2px dashed color-mix(in srgb, var(--gk-gold-pale) 67%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--gk-white) 12%, transparent) 0 58%, color-mix(in srgb, var(--gk-white) 4%, transparent) 70%, transparent 72%);
  transition: opacity var(--gk-fast), transform var(--gk-fast), background var(--gk-fast), border-color var(--gk-fast); }
.trash .bin { position: absolute; right: 9%; top: 9%; filter: drop-shadow(0 1px 2px var(--gk-dark)); }
body.can-discard .trash { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.trash.near { opacity: 1; transform: translate(-50%, -50%) scale(1.06); border: 2px solid var(--gk-bad); color: var(--gk-leave-edge);
  background: radial-gradient(circle, color-mix(in srgb, var(--gk-leave) 25%, transparent) 0 60%, color-mix(in srgb, var(--gk-leave) 10%, transparent) 70%, transparent 72%); box-shadow: 0 0 24px color-mix(in srgb, var(--gk-leave) 33%, transparent); }
.trash.near .bin { animation: bin-wiggle .5s ease-in-out infinite; }
@keyframes bin-wiggle { 25% { transform: rotate(-12deg) scale(1.15); } 75% { transform: rotate(12deg) scale(1.15); } }
body.can-discard .pile.discard::after { content: attr(data-drop); position: absolute; top: calc(100% + 12px); left: 50%; z-index: 2; transform: translateX(-50%); padding: 2px 8px; border-radius: var(--gk-r-pill);
  font: var(--gk-bold) var(--gk-text-xs)/1.4 var(--gk-font); color: var(--gk-gold); background: color-mix(in srgb, var(--gk-well) 90%, transparent); white-space: nowrap; pointer-events: none; }

/* ---------- Cards (the faces are drawn to the card's own size) ---------- */
.card { position: relative; flex: 0 0 auto; width: var(--hw); height: calc(var(--hw) * 1.45); padding: 0; border-radius: calc(var(--hw) * .09); border: 1px solid var(--card-edge);
  background: linear-gradient(160deg, var(--card) 0, var(--card) 55%, var(--card2) 100%); color: var(--card-ink); box-shadow: var(--gk-shadow-1);
  font-family: var(--gk-font); font-weight: var(--gk-number); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform var(--gk-fast), box-shadow var(--gk-fast), translate var(--gk-fast), filter var(--gk-fast); }
.card.red { color: var(--card-red); }
/* Each suit's colour (♥ ♦ ♣ ♠): red and black, unless a card-face skin (shared/cardart.js) gives the suits colours of their own. */
:is(.card, .card.joker.joker-as, .pile.discard, .choice-card).s0 { color: var(--suit-0, var(--card-red)); } :is(.card, .card.joker.joker-as, .pile.discard, .choice-card).s1 { color: var(--suit-1, var(--card-red)); }
:is(.card, .card.joker.joker-as, .pile.discard, .choice-card).s2 { color: var(--suit-2, var(--card-ink)); } :is(.card, .card.joker.joker-as, .pile.discard, .choice-card).s3 { color: var(--suit-3, var(--card-ink)); }
.card .c { position: absolute; top: 4%; left: 6%; display: flex; flex-direction: column; align-items: center; line-height: .92; direction: ltr; }
.card .c b { font-size: calc(var(--hw) * .4 * var(--index, 1)); font-weight: inherit; letter-spacing: -1px; }
.card .c i { font-style: normal; font-size: calc(var(--hw) * .34 * var(--index, 1)); }
.card .c2 { position: absolute; bottom: 4%; right: 6%; display: flex; flex-direction: column; align-items: center; line-height: .92; transform: rotate(180deg); direction: ltr; }
.card .c2 b { font-size: calc(var(--hw) * .26 * var(--index, 1)); font-weight: inherit; } .card .c2 i { font-style: normal; font-size: calc(var(--hw) * .22 * var(--index, 1)); }
.card .p { position: absolute; left: 50%; top: 56%; transform: translate(-30%, -50%); font-size: calc(var(--hw) * .7 * var(--pip, 1)); line-height: 1; }
.card.joker { color: var(--card-purple); }
.card.joker .p { text-shadow: 0 0 10px var(--joker-glow); }
.card.joker-as { background: linear-gradient(145deg, var(--joker-face), var(--joker-face2)); border-color: var(--joker-edge); }
/* A joker standing for a card shows that card in its own colour (red or black); the purple tint and the JOKER band mark it as a joker. */
.card.joker.joker-as { color: var(--card-ink); } .card.joker.joker-as.red { color: var(--card-red); }
.card.joker.joker-as .p { text-shadow: none; }
.card .badge { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; letter-spacing: 1px; direction: ltr; color: var(--gk-white); background: var(--card-purple);
  border-radius: 0 0 calc(var(--hw) * .08) calc(var(--hw) * .08); font: var(--gk-bold) calc(var(--hw) * .14)/1.4 var(--gk-font); }
.card .tag { position: absolute; left: -1px; top: -1px; width: 0; height: 0; border-style: solid; border-width: calc(var(--hw) * .22) calc(var(--hw) * .22) 0 0; border-color: var(--tag) transparent transparent transparent; border-top-left-radius: calc(var(--hw) * .09); }
.card.selected { transform: translateY(-16px); box-shadow: 0 0 0 3px var(--gk-gold), 0 10px 18px var(--gk-dark); }
.card.trial { box-shadow: 0 0 0 3px var(--gk-back), 0 0 16px color-mix(in srgb, var(--gk-back) 67%, transparent); }
/* محترك: a joker in one of your hand groups is only verified when you lay down. */
.card .qmark { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--gk-gold); color: var(--gk-on-gold); font: var(--gk-bold) var(--gk-text-xs)/1 var(--gk-font); box-shadow: var(--gk-shadow-1); }
/* The slot a dragged card came from: an empty dashed outline. */
.card.dragging { opacity: 1; background: color-mix(in srgb, var(--gk-white) 6%, transparent); border: 2px dashed var(--gk-gold); box-shadow: none; translate: none; transform: none; filter: none; }
.card.dragging > * { visibility: hidden; }
/* Floating copies (drag and card flights) get their own compositing layer, so removing them leaves no stale paint. */
.ghost { position: fixed; left: 0; top: 0; z-index: calc(var(--gk-z-toast) + 3); pointer-events: none; transform-origin: center; will-change: transform, opacity;
  transition: scale .14s ease-out, rotate .25s ease-out, box-shadow .14s; box-shadow: 0 18px 36px var(--gk-dark); }
/* Picked up: a little bigger, a gold edge and a deeper shadow, as if lifted off the table. */
.ghost.lifted { scale: 1.1; box-shadow: 0 0 0 3px var(--gk-gold), 0 0 18px color-mix(in srgb, var(--gk-gold) 53%, transparent), 0 28px 46px var(--gk-dark); }
/* Drop spot in the hand: a gold edge on the side the card will go. The cards themselves stay still, so the target never jumps. */
#hand .card.drop-before { box-shadow: -5px 0 0 var(--gk-gold), var(--gk-shadow-1); } #hand .card.drop-after { box-shadow: 5px 0 0 var(--gk-gold), var(--gk-shadow-1); }
body.dragging #hand .card { transition: none; translate: none; }

/* ---------- Hand: overlapping rows; the second row covers the lower part of the first ---------- */
.handarea { position: relative; min-width: 0; padding-top: 14px; }
#playHint { position: absolute; left: 50%; top: -34px; margin-left: -15px; z-index: 4; }
.viewing { position: absolute; top: -4px; left: 50%; z-index: 4; transform: translateX(-50%); padding: 2px 10px; border-radius: var(--gk-r-pill); background: var(--gk-gold-deep); color: var(--gk-on-gold); font-size: var(--gk-text-xs); unicode-bidi: plaintext; }
.hand { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.hrow { width: 100%; display: grid; grid-template-columns: repeat(calc(var(--n, 1) - 1), minmax(0, calc(var(--hw) * .8))) var(--hw); justify-content: center; }
.hrow + .hrow { margin-top: calc(var(--hw) * -.66); }
.hrow .card { z-index: var(--i, 0); }
.hrow .card.selected { z-index: 80; }

/* ---------- Bottom bar: total and Lay down, your avatar, the joker choices and Arrange ---------- */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; padding-top: 18px; }
.bar-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bar-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-bottom: 6px; }
.bar .seat .nameplate { max-width: 110px; }
.total { padding: 5px 10px; border-radius: var(--gk-r-sm); border: 1px solid var(--gk-line); background: color-mix(in srgb, var(--gk-well) 85%, transparent); color: var(--gk-white); font-size: var(--gk-text-sm); white-space: nowrap; unicode-bidi: plaintext; }
.total b { color: var(--gk-gold); font-weight: var(--gk-number); }
/* Lay down is a gold in-game action (.gk-btn.action) once your groups can go down, and glows for الهاند.
   Until it can be pressed it is a plain dark tile, so its word stays readable. */
.lay-btn { min-width: min(38vw, 170px); font-size: var(--gk-text-lg); unicode-bidi: plaintext; }
.lay-btn.hand { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: var(--gk-shadow-2), 0 0 22px var(--gk-gold-warm); } }
.lay-btn:disabled { opacity: 1; filter: none; animation: none; background: linear-gradient(var(--gk-tile), var(--gk-tile-deep)); border-color: var(--gk-line); color: var(--gk-muted); box-shadow: var(--gk-shadow-1); }
/* Arrange and the joker choices: round gold in-game actions. Arrange glows when better groups are possible. */
.round-btn { width: 50px; height: 50px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.round-btn.better { animation: better 1.4s ease-in-out infinite; }
@keyframes better { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--gk-gold) 53%, transparent), 0 0 18px color-mix(in srgb, var(--gk-gold) 67%, transparent), var(--gk-shadow-2); } }
.joker-choice { width: var(--gk-tap); height: var(--gk-tap); font-size: var(--gk-text-xl); line-height: 1; }

/* ---------- Scores and winner: drawn over the table in the pop-up look (dialog.gk-pop) ---------- */
.overlay { position: fixed; inset: 0; z-index: var(--gk-z-pop); display: grid; place-items: center; background: var(--gk-veil); backdrop-filter: blur(2px);
  padding: max(12px, var(--gk-safe-top)) max(12px, var(--gk-safe-end)) max(12px, var(--gk-safe-bottom)) max(12px, var(--gk-safe-start)); }
.panel { position: relative; box-sizing: border-box; width: min(100%, 560px); max-height: calc(100dvh - 24px - var(--gk-safe-top) - var(--gk-safe-bottom)); overflow: auto; overscroll-behavior: contain;
  padding: 16px 14px 18px; border-radius: var(--gk-r-lg); border: 2px solid var(--gk-gold-deep); background: linear-gradient(var(--gk-panel), var(--gk-panel-deep)); box-shadow: var(--gk-shadow-3), var(--gk-inset);
  color: var(--gk-ink); font: var(--gk-regular) var(--gk-text-md)/var(--gk-read) var(--gk-font); text-align: center; }
html[dir=rtl] .panel { direction: rtl; }
.panel h2 { margin: 2px 40px 8px; font: var(--gk-bold) var(--gk-text-lg)/1.3 var(--gk-font); color: var(--gk-white); }
.panel > .gk-btn { display: flex; width: min(70vw, 260px); margin: 14px auto 0; }
/* ✕ in a pop-up's top corner, above its picture (the picture's drop-shadow would otherwise paint over it and take its presses). */
:is(.pop, .panel) > .x { position: absolute; z-index: 2; top: 6px; inset-inline-end: 6px; }
.muted { margin: 6px 0; color: var(--gk-muted); font-size: var(--gk-text-sm); line-height: 1.5; }
.tablewrap { overflow-x: auto; }
.scores table { width: 100%; margin: 6px 0; border-collapse: collapse; font-size: var(--gk-text-md); }
.scores th { max-width: 80px; padding: 6px 4px; color: var(--gk-white); font-size: var(--gk-text-xs); font-weight: var(--gk-bold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.scores td { padding: 5px 4px; border-top: 1px solid var(--gk-line-soft); color: var(--gk-white); }
.scores tr:nth-child(even) td { background: color-mix(in srgb, var(--gk-white) 3%, transparent); }
.scores td.rn { color: var(--gk-muted); font-size: var(--gk-text-sm); }
.scores td.neg { color: var(--gk-good); }
.scores tr.final td { padding-top: 8px; border-top: 2px solid var(--gk-line); }
.pillv { display: inline-block; min-width: 46px; padding: 4px 8px; border-radius: var(--gk-r-sm); border: 1px solid var(--gk-ring); font-weight: var(--gk-number); }
.pillv.good { background: var(--gk-go); } .pillv.bad { background: var(--gk-leave-deep); }
.winner { padding-top: 8px; }
.rank { display: grid; grid-template-columns: 30px 40px 1fr auto; align-items: center; gap: 10px; margin: 6px 0; padding: 8px 10px; border-radius: var(--gk-r-md); border: 1px solid var(--gk-line-soft);
  background: color-mix(in srgb, var(--gk-night) 30%, transparent); font-size: var(--gk-text-md); text-align: start; }
.rank.me { border-color: var(--gk-gold); background: color-mix(in srgb, var(--gk-gold) 12%, transparent); }
.rank .no { font: var(--gk-number) var(--gk-text-xl)/1 var(--gk-font); color: var(--gk-white); }
.rank .av { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gk-white); display: grid; place-items: center; background: var(--gk-tile); font-size: var(--gk-text-lg); }
.rank .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.rank .sc { font-size: var(--gk-text-lg); font-weight: var(--gk-number); }

/* ---------- Dealing, the room's count, messages, fireworks: above everything but a dragged card ---------- */
/* Dealing a new round: card backs fly from the deck to each player (see dealCheck in app.js). */
.deal { position: fixed; inset: 0; z-index: calc(var(--gk-z-toast) + 1); pointer-events: none; overflow: hidden; }
.dealcard { position: absolute; border-radius: calc(var(--pw) * .1); border: 2px solid var(--back-edge); box-shadow: var(--gk-shadow-2); will-change: transform, opacity;
  background: radial-gradient(circle at 50% 50%, var(--back-dot) 0 13%, transparent 14%), repeating-linear-gradient(45deg, var(--back) 0 5px, var(--back2) 5px 10px); }
/* The count before a room's match starts: a large number over the dimmed table (the look of .gk-count). */
.startcount { position: fixed; inset: 0; z-index: calc(var(--gk-z-toast) + 2); display: grid; place-items: center; pointer-events: none; background: var(--gk-veil);
  color: var(--gk-gold-pale); font: var(--gk-number) clamp(96px, 30vw, 220px)/1 var(--gk-font); text-shadow: 0 6px 0 var(--gk-on-gold-soft), 0 14px 40px var(--gk-dark); }
.startcount.tick { animation: count-in .8s ease-out both; }
@keyframes count-in { from { transform: scale(1.7); opacity: 0; } 25% { opacity: 1; } to { transform: scale(1); } }
/* A message in the middle of the screen: the site's message (.gk-toast); app.js shows it, closes it after 3 s or on any press. */
.toast { position: fixed; left: 50%; top: 50%; z-index: var(--gk-z-toast); translate: -50% -50%; box-sizing: border-box; width: max-content; max-width: min(86vw, 420px); margin: 0; padding: 14px 22px;
  border-radius: var(--gk-r-lg); border: 1px solid var(--gk-gold-deep); background: color-mix(in srgb, var(--gk-well) 95%, transparent); box-shadow: var(--gk-shadow-3), var(--gk-inset);
  color: var(--gk-gold-pale); font: var(--gk-bold) var(--gk-text-md)/1.5 var(--gk-font); text-align: center; cursor: pointer; backdrop-filter: blur(3px); }
.toast:empty { display: none; }
.toast.show { animation: toast-in var(--gk-move) ease-out; }
.toast.out { opacity: 0; scale: .95; transition: opacity var(--gk-fast), scale var(--gk-fast); }
@keyframes toast-in { from { opacity: 0; scale: .92; } }
.fireworks { position: fixed; inset: 0; z-index: calc(var(--gk-z-toast) + 4); width: 100%; height: 100%; pointer-events: none; }

/* ---------- Options menu: the site's side menu (dialog.gk-menu); the rules button sits at its bottom ---------- */
dialog.options[open] { display: flex; flex-direction: column; }
dialog.options .rulesbtn { margin-top: auto; flex: none; }

/* ---------- Pop-ups: the site's pop-up (dialog.gk-pop). .pop marks the ones whose choices app.js draws as tiles ---------- */
.settings.one { grid-template-columns: 1fr; }
/* In the room pop-up (no Players choice) the Ace tiles take the whole row */
#settings:has(#playersRow[hidden]) #aceRow { grid-column: 1 / -1; }
.pop .field { margin-top: 8px; }
.settings .field { margin-top: 0; }
/* The choices are the site's tiles (.gk-seg, drawn by app.js from hidden <select>s). None is cut short: a word that does not
   fit its tile takes a second line instead (the 1 ضد 1 / 2 players tile on a phone). */
.seg button :is(b, small) { white-space: normal; overflow: visible; text-overflow: clip; text-wrap: balance; line-height: 1.2; }
.seg button:disabled { opacity: 1; cursor: default; }
.seg.off { opacity: .5; }
.seg.grid2 { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.seg.grid2 button { flex-direction: row; gap: 8px; justify-content: flex-start; padding: 10px 12px; }
.seg.grid2 button b { font-size: var(--gk-text-sm); text-align: start; }
/* Rule switches (خبيثة / محترك / فرق, pausing bots, mute): tiles with a real checkbox, visually hidden but still focusable.
   A small circle in the corner is ticked when on, as on the site's switches. */
.sr { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.tog { position: relative; min-width: 0; min-height: 58px; margin: 0; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: var(--gk-r-md); border: 1px solid var(--gk-line-soft); background: linear-gradient(var(--gk-tile), var(--gk-tile-deep)); box-shadow: var(--gk-shadow-1);
  color: var(--gk-ink-soft); font-size: var(--gk-text-sm); text-align: center; cursor: pointer; transition: background var(--gk-move), box-shadow var(--gk-move), filter var(--gk-fast), scale var(--gk-fast); }
.tog:has(input:focus-visible) { outline: var(--gk-focus); outline-offset: var(--gk-focus-gap); }
.tog b { max-width: 100%; font: var(--gk-bold) clamp(var(--gk-text-sm), 4vw, var(--gk-text-md))/1.45 var(--gk-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tog small { max-width: 100%; color: var(--gk-muted); font-size: var(--gk-text-xs); line-height: 1.2; text-wrap: balance; }
.tog .ic { font-size: var(--gk-text-lg); line-height: 1.1; filter: grayscale(.6); opacity: .75; }
.tog::after { content: ""; position: absolute; top: 5px; inset-inline-end: 5px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--gk-ring); font: var(--gk-bold) var(--gk-text-xs)/16px var(--gk-font); text-align: center; }
.tog:has(input:checked) { background: linear-gradient(var(--gk-gold-pale), var(--gk-gold-warm)); border-color: var(--gk-gold-edge); color: var(--gk-on-gold);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--gk-gold-warm) 33%, transparent), inset 0 1px 0 var(--gk-shine); }
.tog:has(input:checked) small { color: var(--gk-on-gold-soft); }
.tog:has(input:checked) .ic { filter: none; opacity: 1; }
.tog:has(input:checked)::after { content: "✓"; border-color: var(--gk-on-gold-soft); color: var(--gk-on-gold); }
.tog:has(input:disabled) { opacity: .5; cursor: default; }
/* Rounds: type any number, or use − / +. The same sunken tray as the tiles beside it. */
.stepper { display: flex; gap: 4px; padding: 4px; border-radius: var(--gk-r-lg); border: 1px solid var(--gk-line); background: var(--gk-well); box-shadow: var(--gk-sunk); }
.pop .stepper input[type=number] { flex: 1; min-width: 0; min-height: 54px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--gk-ink);
  text-align: center; font: var(--gk-number) var(--gk-text-xl)/1 var(--gk-font); -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepbtn { width: var(--gk-tap); flex: none; padding: 0; border-radius: var(--gk-r-md); border: 1px solid var(--gk-line-soft); background: linear-gradient(var(--gk-tile), var(--gk-tile-deep));
  box-shadow: var(--gk-shadow-1); color: var(--gk-gold); font: var(--gk-bold) var(--gk-text-xl)/1 var(--gk-font); }
/* Room: the coins and the room's state, the closing countdown, the invite link */
.roominfo { margin: 4px 0 10px; color: var(--gk-gold); font-size: var(--gk-text-md); font-weight: var(--gk-bold); line-height: 1.5; }
#roomFeedback { color: var(--gk-gold-pale); }
.pop label.col { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 0; text-align: start; color: var(--gk-gold); font-size: var(--gk-text-xs); font-weight: var(--gk-bold); line-height: 1.4; }
/* Room countdown: until a room nobody joined closes (5 minutes). Turns red in the last minute. */
.roomexpiry { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; width: fit-content; max-width: 100%; margin: 2px auto 12px; padding: 8px 14px;
  border-radius: var(--gk-r-pill); border: 1px solid var(--gk-gold-deep); background: var(--gk-well); color: var(--gk-ink); font-size: var(--gk-text-sm); line-height: 1.4; }
.roomexpiry b { min-width: 3.2ch; text-align: center; color: var(--gk-gold); font: var(--gk-number) var(--gk-text-lg)/1 var(--gk-font); font-variant-numeric: tabular-nums; }
.roomexpiry.soon { border-color: var(--gk-bad); } .roomexpiry.soon b { color: var(--gk-bad); }
/* Join a room: the code box (.gk-code) with Join beside it */
.joinrow { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.joinrow .gk-code { flex: 1; min-width: 0; margin: 0; }
.joinrow .gk-code::placeholder { letter-spacing: 0; color: var(--gk-muted); font-size: var(--gk-text-md); font-weight: var(--gk-regular); }
.joinrow .gk-btn { flex: none; }
/* Tests: bot switches, single steps, scenarios and the engine log */
.testtogs { margin: 8px 0 4px; }
.pop .test { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0; }
.pop .log { max-height: 160px; overflow: auto; margin-top: 8px; padding: 6px 10px; border-radius: var(--gk-r-md); background: color-mix(in srgb, var(--gk-night) 30%, transparent);
  color: var(--gk-muted); font-size: var(--gk-text-xs); line-height: 1.4; text-align: start; }
.pop .log:empty { display: none; }
/* Game rules: fixed title and Close, the rules scroll between them. One block per language; the page language picks which shows. */
dialog.pop.rules[open] { display: flex; flex-direction: column; overflow: hidden; height: calc(100dvh - 24px - var(--gk-safe-top) - var(--gk-safe-bottom)); }
.rules .rulesbody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 2px 6px 6px; text-align: start; scrollbar-width: thin; scrollbar-color: var(--gk-gold-deep) transparent; }
.rules .rulesbody:focus-visible { outline: var(--gk-focus); outline-offset: -3px; border-radius: var(--gk-r-md); }
html:not([lang=ar]) .rules .ar, html[lang=ar] .rules .en { display: none; }
.rules section { margin: 0 0 10px; padding: 12px 14px; border-radius: var(--gk-r-lg); border: 1px solid var(--gk-line); background: color-mix(in srgb, var(--gk-well) 60%, transparent); }
.rules h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--gk-gold); font: var(--gk-bold) var(--gk-text-lg)/1.3 var(--gk-font); }
.rules p, .rules li { margin: 0; color: var(--gk-ink-soft); font-size: var(--gk-text-md); line-height: var(--gk-read); }
.rules p + p, .rules ul + p, .rules ol + p, .rules table + p { margin-top: 8px; }
.rules ul, .rules ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.rules li::marker { color: var(--gk-gold); }
.rules b { color: var(--gk-gold-pale); }
.rules table { width: 100%; margin-top: 2px; border-collapse: collapse; font-size: var(--gk-text-sm); }
.rules th, .rules td { padding: 7px 6px; border-bottom: 1px solid var(--gk-line-soft); text-align: center; }
.rules th { color: var(--gk-gold); font-weight: var(--gk-bold); }
.rules td:first-child { text-align: start; font-weight: var(--gk-bold); white-space: nowrap; }
.rules .gk-row { flex: none; margin-top: 10px; }
/* Joker choices: one button per possible reading of the group, its cards drawn small. */
dialog.jokerdlg { width: min(94vw, 520px); }
.jokertext { margin-top: 4px; }
.suitpicks { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; direction: ltr; }
.group-choice { max-width: 100%; padding: 8px; border-radius: var(--gk-r-md); border: 1px solid var(--gk-muted); background: var(--gk-raise-deep); color: var(--gk-ink); cursor: pointer; }
.group-choice > small { display: block; margin-bottom: 6px; font-size: var(--gk-text-sm); }
.group-choice:hover, .group-choice:focus-visible { outline: 2px solid var(--gk-gold); }
.choice-cards { display: flex; justify-content: center; gap: 3px; direction: ltr; }
.choice-card { min-width: 36px; min-height: 50px; padding: 4px; border-radius: var(--gk-r-sm); display: flex; flex-direction: column; justify-content: center; background: var(--card); color: var(--card-ink); font: var(--gk-number) var(--gk-text-lg)/1.4 var(--gk-font); }
.choice-card.red { color: var(--card-red); }
.choice-card.is-joker { background: var(--joker-face2); }
.choice-card small { color: var(--card-purple); font-size: var(--gk-text-xs); }

/* New game in the middle of the empty table. It is placed with translate, not transform, so the shared press effect
   (a transform) does not move it. */
.tablenew { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 5; margin: 0; padding: 16px 34px; font-size: clamp(var(--gk-text-lg), 4.6vw, var(--gk-text-2xl)); }

/* One hover and press effect for the table's own buttons and tiles: a little brighter on hover, a little smaller while pressed.
   It uses the scale property, which adds to any transform a button already has. The site's buttons (.gk-btn, .gk-big)
   have their own; cards are left out (they lift when selected and are dragged). */
:where(button:not(.card, .gk-btn, .gk-big, .gk-x), label.tog) { transition: filter var(--gk-fast), scale var(--gk-fast); }
:where(button:not(.card, .gk-btn, .gk-big, .gk-x):not(:disabled), label.tog:not(:has(input:disabled))):hover { filter: brightness(1.06); }
:where(button:not(.card, .gk-btn, .gk-big, .gk-x):not(:disabled), label.tog:not(:has(input:disabled))):active { scale: .97; }
/* Hand cards: the same brighten as the buttons, plus a small lift (selected cards are already lifted). Only on devices
   with a real pointer, so a tap on a phone does not leave a card stuck in the hover state. */
@media (hover: hover) {
  .hand .card:not(.dragging):hover { filter: brightness(1.06); }
  .hand .card:not(.selected):not(.dragging):hover { translate: 0 -6px; }
}
/* While a card is dragged the closed hand shows everywhere. The id inside :is() only lifts this rule above every class rule
   (buttons and cards name their own cursor), so it needs no forced priority. */
body.dragging, body.dragging :is(*, #game) { cursor: grabbing; }

/* ---------- Screens ---------- */
/* Tablets and desktops: a little more room around the table and larger avatars (still smaller on a short window).
   app.js lays the hand out in one row from 760px wide. */
@media (min-width: 600px) {
  :root { --av: clamp(40px, 9.4dvh, 62px); }
  .game { padding: 10px max(16px, var(--gk-safe-end)) max(12px, var(--gk-safe-bottom)) max(16px, var(--gk-safe-start)); }
  .hud { grid-template-columns: 76px 1fr 110px; }
}
/* A phone held sideways has no height to spare: the site's bar is left out (the table keeps its own gear), the avatars and
   cards are smaller, and the fanned card backs and the plates' second line go. Hiding the bar has to be forced, as
   shared/bar.css forces the bar's display: grid. In the pop-ups the title ribbon moves to the top edge, under the ✕. */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --av: 40px; --hw: min(15.5vw, 8.6dvh, 80px); }
  html.gk-bar header.topbar { display: none !important; }
  html.gk-bar .hud .gear { visibility: visible; }
  .game { padding-top: max(6px, var(--gk-safe-top)); padding-bottom: max(6px, var(--gk-safe-bottom)); }
  .fan, .nameplate small { display: none; }
  .pop > .x, .pop > .x:hover { top: 0; color: var(--gk-on-gold); }
  .pop .stepper input[type=number] { min-height: 46px; }
}
