/* COLORO CARDO. The felt with the two piles; your cards in one row under it; the players, whose turn it is and what just
   happened in a rail beside it (desktop, and a tablet or phone on its side). Upright phones and tablets: the other players
   above the felt, the turn line and your cards under it.
   app.js measures the room (shared/fit.js): --cw on .stage is the width of a card in your hand, --felt-w and --felt-h the
   felt's size. The cards on the felt (--pile) follow the felt. */
/* The four card colours come from art.js (app.js writes them here as --coral, --amber, --teal and --violet). */
.stage { --cw: 66px; flex: 1; min-height: 0; display: flex; justify-content: center; gap: 16px; padding: 12px max(12px, var(--gk-safe-end)) max(12px, var(--gk-safe-bottom)) max(12px, var(--gk-safe-start)); }
.table { flex: 1; min-width: 0; min-height: 0; max-width: 1180px; display: flex; flex-direction: column; gap: 10px; }
.felt-wrap { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; }
.felt { --felt-w: 360px; --felt-h: 240px; --pile: max(48px, min(var(--cw) * 1.25, var(--felt-h) * .42, var(--felt-w) / 4.2));
  position: relative; width: var(--felt-w); height: var(--felt-h); display: grid; place-items: center; direction: ltr;
  border: 6px solid var(--gk-rim); border-radius: calc(min(var(--felt-w), var(--felt-h)) * .16);
  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), var(--gk-shadow-2), inset 0 0 0 2px var(--gk-line-soft), inset 0 0 60px color-mix(in srgb, var(--gk-night) 50%, transparent); }

/* Cards: each one is a drawing from art.js (an SVG of 100 × 145), sized by --cw. */
.card { position: relative; display: block; flex: none; width: var(--cw); height: calc(var(--cw) * 1.45); padding: 0; border: 0; border-radius: calc(var(--cw) * .13);
  background: none; box-shadow: var(--gk-shadow-1); overflow: hidden; direction: ltr; user-select: none; -webkit-user-select: none; }
.card svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.c0 { --paint: var(--coral); } .c1 { --paint: var(--amber); } .c2 { --paint: var(--teal); } .c3 { --paint: var(--violet); }

/* The piles in the middle of the felt */
.centre { --cw: var(--pile); display: flex; align-items: flex-start; gap: calc(var(--cw) * .32); }
.pile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--gk-ink); }
.pile-note { display: flex; align-items: center; gap: 5px; min-height: 20px; font-size: var(--gk-text-xs); white-space: nowrap; }
.pile-note b { color: var(--gk-gold); font-size: var(--gk-text-sm); font-weight: var(--gk-number); }
.pile-note small { font-size: inherit; }
#stock .card { box-shadow: 2px 2px 0 var(--gk-rim), 4px 4px 0 var(--gk-gold-deep), 5px 6px 8px var(--gk-dark); }
#stock.ready .card { animation: ready .7s ease-in-out infinite alternate; }
@keyframes ready { to { translate: 0 -6%; box-shadow: 2px 2px 0 var(--gk-rim), 4px 4px 0 var(--gk-gold-deep), 0 0 0 3px var(--gk-gold), 0 0 22px var(--gk-gold); } }
#stock:disabled { opacity: 1; cursor: default; }
.discard { width: var(--cw); height: calc(var(--cw) * 1.45); border-radius: calc(var(--cw) * .14); box-shadow: 0 0 0 3px var(--now, transparent), 0 0 26px var(--now, transparent); transition: box-shadow var(--gk-move); }
.discard .card { rotate: 4deg; }
.chip { display: inline-block; width: 15px; height: 15px; rotate: 45deg; border-radius: calc(var(--gk-r-sm) / 2); background: var(--now, var(--gk-muted)); border: 2px solid var(--gk-ink); }
.direction { align-self: center; font-size: calc(var(--cw) * .5); line-height: 1; color: var(--gk-ink-soft); opacity: .7; animation: spin 6s linear infinite; }
.direction.ccw { animation-direction: reverse; scale: -1 1; }
@keyframes spin { to { rotate: 360deg; } }
.flying { position: fixed; z-index: var(--gk-z-menu); margin: 0; pointer-events: none; }

/* Your cards: one row that overlaps more as it grows (app.js spaces them), never wrapping or scrolling. The cards that can be
   played stand higher; the 3px around them leaves room for their gold ring. */
.hand { flex: none; position: relative; height: calc(var(--cw) * 1.65 + 6px); overflow: hidden; direction: ltr; }
.hand-inner { position: relative; height: 100%; margin: 0 auto; }
.hand .card { position: absolute; top: calc(var(--cw) * .2 + 3px); transition: left var(--gk-move) ease, top var(--gk-fast) ease, filter var(--gk-fast); }
.hand .card.can { top: calc(var(--cw) * .04 + 3px); cursor: pointer; }
.hand .card.can:hover { top: 3px; box-shadow: 0 0 0 3px var(--gk-gold), var(--gk-shadow-2); }
.hand .card.cannot { filter: brightness(.58) saturate(.8); cursor: default; }
.hand .card.drawn { box-shadow: 0 0 0 3px var(--gk-gold), 0 0 18px var(--gk-gold); }
.hand .card.shake { animation: shake .26s; }
.hand .card:focus-visible { outline-offset: -4px; }
@keyframes shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }

/* The rail: the players in play order from you, then the turn line, the last event and the gold buttons. */
.rail { flex: none; width: 288px; min-height: 0; display: flex; flex-direction: column; justify-content: center; justify-content: safe center; gap: 14px; }
.seats { display: grid; gap: 8px; }
html[dir=rtl] .gk-seat { direction: rtl; }
.gk-seat .card { --cw: 22px; box-shadow: 0 0 0 2px var(--seat); }
/* On the player's face a small card back is the badge. */
.gk-face > .card.gk-face-badge { --cw: .8em; width: var(--cw); height: calc(var(--cw) * 1.45); border-radius: .12em; background: none; rotate: 12deg; box-shadow: 0 0 0 .1em var(--seat), 0 .08em .16em rgb(0 0 0 / .45); }
.gk-seat.last .gk-seat-score { animation: last .6s ease-in-out infinite alternate; }
@keyframes last { to { scale: 1.3; } }
.turn { display: flex; flex-direction: column; gap: 10px; }
.turn-text { min-width: 0; }
.tools { display: flex; gap: 10px; min-height: var(--gk-tap); }
.tools .gk-btn { flex: 1; }
/* A clear table behind New game and while a room waits for its people. */
html.gk-clear :is(#hand-inner > *, .gk-seat .card, .centre) { visibility: hidden; }

/* The colour for a wild card: four tiles in the card colours (a shared pop-up, built in app.js). */
.paints { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 2px; }
.paint { min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-radius: var(--gk-r-lg); border: 3px solid var(--gk-gold-pale); background: var(--paint); color: var(--gk-white); font: var(--gk-bold) var(--gk-text-md)/1.2 var(--gk-font); text-shadow: 0 1px 3px var(--gk-dark); box-shadow: var(--gk-shadow-2); }
.paint svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 2px var(--gk-dark)); }
.paint:hover { filter: brightness(1.1); } .paint:active { translate: 0 2px; }

/* Upright phones and tablets: the other players above the felt, then the felt, the turn line and your cards.
   The rail and the table give their parts to the page's column, in that order. */
@media (max-width: 1023px) and (orientation: portrait) {
  .stage { flex-direction: column; gap: 8px; padding-top: 8px; }
  .table, .rail { display: contents; }
  .seats { order: 1; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; direction: ltr; }
  .felt-wrap { order: 2; } .turn { order: 3; } .hand { order: 4; }
  .gk-seat.me { display: none; }
  .turn { flex-direction: row; align-items: center; justify-content: center; gap: 12px; min-height: var(--gk-tap); }
  .turn-text { flex: 1; text-align: center; }
  .turn-text p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tools { flex: none; }
}
/* A phone: small plates with a small face, the name and the number of cards. */
@media (max-width: 599px) {
  .gk-seat { padding: 6px 7px; gap: 5px; border-radius: var(--gk-r-md); } .gk-seat-note, .gk-seat .card { display: none; }
  .gk-seat .gk-face { font-size: 12px; }
  .gk-seat-score { min-width: 0; font-size: var(--gk-text-md); }
  .tools .gk-btn { padding: 8px 14px; }
}
/* An upright tablet: more room between the parts. */
@media (min-width: 600px) and (max-width: 1023px) and (orientation: portrait) {
  .stage { gap: 12px; padding-top: 12px; } .seats { gap: 10px; } .gk-turn { font-size: var(--gk-text-lg); }
}
/* A tablet on its side: a narrower rail. */
@media (min-width: 600px) and (max-width: 1023px) and (orientation: landscape) { .rail { width: 248px; } }
@media (min-width: 1024px) { .stage { gap: 20px; padding-top: 16px; } .rail { width: 300px; } }
/* A sideways phone: a narrow rail with small plates; your own plate goes, as your cards are beside it. */
@media (orientation: landscape) and (max-height: 560px) {
  .stage { gap: 12px; padding-top: 6px; padding-bottom: max(6px, var(--gk-safe-bottom)); }
  .table { gap: 6px; } .rail { width: 220px; gap: 8px; } .seats { gap: 5px; } .turn { gap: 6px; }
  .gk-seat { padding: 5px 10px; } .gk-seat-note, .gk-seat.me { display: none; } .gk-seat .card { --cw: 16px; }
  .gk-turn { font-size: var(--gk-text-sm); } .gk-event { font-size: var(--gk-text-xs); }
  .paint { min-height: 56px; }
}
