/* The game channels post (content/blog/posts/game-channels.json): a mock
   of a game channel in the apps, a header with the people in the voice and
   the spectator count, a Mau table on indigo felt with the real card art
   (web-static/assets/mau) and the channel's chat beside it. The markup is a
   still frame (Mia has just said Mau!); web-static/js/blog-game-channel.js
   deals and plays it in a loop, unless the visitor asks for reduced motion.
   Avatars are rounded squares, as in the apps. */

.gc-figure { margin: 30px -14px; }

.gc-demo {
  --gc-bg: #16181c;
  --gc-panel: #1e2126;
  --gc-line: rgba(255, 255, 255, 0.07);
  --gc-ink: #eceee9;
  --gc-mut: #9aa19a;
  --gc-green: #3fbf6a;
  container: gc / inline-size;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background: var(--gc-bg);
  color: var(--gc-ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 24px 60px rgba(20, 32, 24, 0.22), 0 0 0 1px rgba(20, 32, 24, 0.14);
  -webkit-user-select: none;
  user-select: none;
}

/* ---- Header: channel, voice, spectators ---- */

.gc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gc-line);
  background: var(--gc-panel);
}

.gc-chan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.gc-chan i { color: var(--gc-green); font-size: 14px; }

.gc-voice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.gc-voice-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
  color: var(--gc-mut);
  font-size: 12px;
  white-space: nowrap;
}

.gc-voice-label i { color: var(--gc-green); font-size: 11px; }

.gc-watch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--gc-mut);
  font-size: 12px;
  white-space: nowrap;
}

.gc-watch i { font-size: 11px; }

/* ---- Avatars (rounded squares) and the speaking ring ---- */

.gc-av {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 30%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  transition: box-shadow 0.25s ease;
}

.gc-c0 { background: #df6b57; }
.gc-c1 { background: #2f9c8f; }
.gc-c2 { background: #8b5cf6; }
.gc-c3 { background: #d99a2b; }
.gc-c4 { background: #4f7fe0; }

.gc-av.is-speaking {
  box-shadow: 0 0 0 2px var(--gc-bg), 0 0 0 4px var(--gc-green);
  animation: gc-speak 0.9s ease-in-out infinite alternate;
}

@keyframes gc-speak {
  from { box-shadow: 0 0 0 2px var(--gc-bg), 0 0 0 3px var(--gc-green); }
  to { box-shadow: 0 0 0 2px var(--gc-bg), 0 0 0 5px rgba(63, 191, 106, 0.55); }
}

/* ---- Body: the table beside the chat ---- */

.gc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
}

.gc-stage { display: flex; flex-direction: column; min-width: 0; }

.gc-table {
  container: gctable / inline-size;
  position: relative;
  aspect-ratio: 1.42;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 52% at 50% 50%, rgba(255, 255, 255, 0.1), transparent 70%),
    radial-gradient(circle at 50% 45%, #3c43a8, #262a72 62%, #1c1f55);
}

.gc-table::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.gc-card {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 5px rgba(8, 10, 40, 0.45));
}

/* Seats: a fan of card backs, the name tag with the count, and the
   Mau! bubble. */
.gc-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
}

.gc-seat-b { left: 50%; top: 84%; }
.gc-seat-l { left: 13%; top: 50%; }
.gc-seat-t { left: 50%; top: 17%; }
.gc-seat-r { left: 87%; top: 50%; }

.gc-seat-b { flex-direction: column-reverse; }

.gc-fan {
  display: flex;
  justify-content: center;
  height: calc(7.4cqw * 1.4);
  min-width: 10cqw;
}

.gc-fan img {
  width: 7.4cqw;
  height: auto;
  margin: 0 -2.4cqw;
  transform-origin: 50% 120%;
  filter: drop-shadow(0 2px 3px rgba(8, 10, 40, 0.5));
}

/* The fan opens around its middle card, however many there are. */
.gc-fan img:first-child:nth-last-child(2) { transform: rotate(-7deg); }
.gc-fan img:first-child:nth-last-child(2) + img { transform: rotate(7deg); }
.gc-fan img:first-child:nth-last-child(3) { transform: rotate(-12deg); }
.gc-fan img:first-child:nth-last-child(3) ~ img:last-child { transform: rotate(12deg); }
.gc-fan img:first-child:nth-last-child(4) { transform: rotate(-15deg); }
.gc-fan img:first-child:nth-last-child(4) + img { transform: rotate(-5deg); }
.gc-fan img:first-child:nth-last-child(4) + img + img { transform: rotate(5deg); }
.gc-fan img:first-child:nth-last-child(4) ~ img:last-child { transform: rotate(15deg); }
.gc-fan img:first-child:nth-last-child(5) { transform: rotate(-16deg); }
.gc-fan img:first-child:nth-last-child(5) + img { transform: rotate(-8deg); }
.gc-fan img:first-child:nth-last-child(5) ~ img:nth-child(4) { transform: rotate(8deg); }
.gc-fan img:first-child:nth-last-child(5) ~ img:last-child { transform: rotate(16deg); }

.gc-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 10px;
  background: rgba(10, 12, 40, 0.55);
  font-size: 12px;
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

.gc-tag b { font-weight: 600; }

.gc-tag .gc-av { width: 20px; height: 20px; font-size: 10px; }

.gc-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
  font-size: 11px;
  text-align: center;
}

.gc-seat.is-turn .gc-tag {
  background: rgba(63, 191, 106, 0.22);
  box-shadow: 0 0 0 1.5px var(--gc-green);
}

.gc-bubble {
  position: absolute;
  left: 62%;
  top: -14px;
  padding: 4px 10px;
  border-radius: 12px 12px 12px 3px;
  background: #ffd25e;
  color: #3a1d16;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(8, 10, 40, 0.35);
  opacity: 0;
  transform: scale(0.4) rotate(-8deg);
  transform-origin: 0 100%;
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.gc-seat.has-mau .gc-bubble { opacity: 1; transform: scale(1) rotate(-6deg); }

/* At the top of the table the bubble sits beside the cards, not above them. */
.gc-seat-t .gc-bubble { top: 8px; left: 72%; }

.gc-bubble::after {
  content: "✦";
  position: absolute;
  right: -10px;
  top: -9px;
  color: #fff6d0;
  font-size: 13px;
}

/* A stamp over a seat: Skip, +2, +1 */
.gc-stamp {
  position: absolute;
  left: 50%;
  top: 40%;
  padding: 3px 9px;
  border-radius: 8px;
  border: 2px solid currentColor;
  background: rgba(22, 24, 28, 0.85);
  color: #ff8a6b;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  animation: gc-stamp 1.1s ease forwards;
}

.gc-stamp.is-draw { color: #9fd0ff; }

@keyframes gc-stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8) rotate(-12deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  75% { opacity: 1; transform: translate(-50%, -60%) scale(1) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9) rotate(-8deg); }
}

/* The middle: the draw pile and the discard pile, ringed in the colour to
   match. */
.gc-center {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 5cqw;
  transform: translate(-50%, -50%);
}

.gc-deck {
  position: relative;
  width: 12cqw;
}

.gc-deck::before {
  content: "";
  position: absolute;
  inset: 3px -3px -3px 3px;
  border-radius: 9%;
  background: #f5ead6;
  box-shadow: 0 2px 4px rgba(8, 10, 40, 0.4);
}

.gc-deck img { position: relative; }

.gc-pile {
  position: relative;
  width: 13.5cqw;
  aspect-ratio: 360 / 504;
  border-radius: 12%;
  transition: box-shadow 0.4s ease;
}

.gc-pile[data-color="green"] { box-shadow: 0 0 22px 6px rgba(108, 192, 112, 0.55); }
.gc-pile[data-color="red"] { box-shadow: 0 0 22px 6px rgba(232, 82, 74, 0.55); }
.gc-pile[data-color="yellow"] { box-shadow: 0 0 22px 6px rgba(246, 195, 67, 0.55); }
.gc-pile[data-color="blue"] { box-shadow: 0 0 22px 6px rgba(79, 127, 224, 0.65); }

.gc-pile img {
  position: absolute;
  inset: 0;
}

/* A card in flight, drawn by the script above the table. */
.gc-fly {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
}

/* The win: a banner and confetti in the card colours. */
.gc-win {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  padding: 10px 18px;
  border-radius: 16px;
  background: #fff8ec;
  color: #3a1d16;
  text-align: center;
  box-shadow: 0 14px 30px rgba(8, 10, 40, 0.45);
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.gc-win b {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
}

.gc-win span { color: #c4511a; font-weight: 700; font-size: 13px; }

.gc-table.is-won .gc-win { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.gc-confetti {
  position: absolute;
  top: -12px;
  z-index: 6;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  pointer-events: none;
  animation: gc-fall 1.8s cubic-bezier(0.3, 0.6, 0.6, 1) forwards;
}

@keyframes gc-fall {
  to { transform: translate(var(--dx), 120cqw) rotate(var(--rot)); opacity: 0.2; }
}

/* Under the table: what a spectator sees until they join the voice. */
.gc-spectate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-top: 1px solid var(--gc-line);
  background: var(--gc-panel);
  color: var(--gc-mut);
  font-size: 12.5px;
}

.gc-spectate i { color: var(--gc-mut); font-size: 12px; }

.gc-btn {
  margin-left: auto;
  padding: 5px 11px;
  border-radius: 9px;
  background: #2f8a50;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

/* ---- Chat ---- */

.gc-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--gc-line);
  background: var(--gc-panel);
}

.gc-chat-title {
  padding: 10px 14px 6px;
  color: var(--gc-mut);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gc-chat-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 9px;
  padding: 6px 12px 14px;
  overflow: hidden;
}

.gc-msg {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  animation: gc-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gc-msg b { display: block; font-size: 12px; font-weight: 700; }

.gc-msg span:last-child { color: #d8dbd6; overflow-wrap: anywhere; }

.gc-result {
  display: block;
  padding: 9px 11px;
  border-radius: 12px;
  background: linear-gradient(120deg, #fff6e6, #ffd9b0);
  color: #3a1d16;
  animation: gc-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gc-result b { display: block; font-size: 13px; }

.gc-result span { color: #9a4a22; font-size: 12px; font-weight: 600; }

@keyframes gc-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to { opacity: 1; transform: none; }
}

/* ---- Narrow: the chat goes under the table ---- */

@container gc (max-width: 560px) {
  .gc-body { grid-template-columns: minmax(0, 1fr); }
  .gc-chat { border-left: 0; border-top: 1px solid var(--gc-line); }
  .gc-chat-list { height: 132px; flex: none; }
  .gc-voice { margin-left: 0; order: 3; width: 100%; }
  .gc-watch { margin-left: auto; }
  .gc-table { aspect-ratio: 1.08; }
  .gc-seat-b { top: 87%; }
  .gc-seat-t { top: 14%; }
  .gc-seat-l { left: 15%; }
  .gc-seat-r { left: 85%; }
  .gc-tag { gap: 4px; padding: 2px 6px 2px 2px; font-size: 11px; }
  .gc-tag .gc-av { width: 17px; height: 17px; font-size: 9px; }
  .gc-bubble { font-size: 13px; }
  .gc-stamp { font-size: 13px; }
  .gc-spectate .gc-text { min-width: 0; }
}

@media (max-width: 760px) {
  .gc-figure { margin: 24px -8px; }
}

@media (prefers-reduced-motion: reduce) {
  .gc-av.is-speaking { animation: none; }
  .gc-msg, .gc-result { animation: none; }
}
