/* Crazy Eights — a diner table: formica top, chrome rim, cream cards. */
.c8-table {
  --base: min(22vw, 12vh, 96px);
  --cw: var(--base);
  position: absolute;
  top: 6px; right: 6px; bottom: 4px; left: 6px;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px 8px;
  direction: ltr;
  border-radius: 26px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 241, 214, 0.07) 0 2px, transparent 3px) 0 0 / 46px 46px,
    radial-gradient(circle at 70% 75%, rgba(111, 183, 233, 0.1) 0 2px, transparent 3px) 0 0 / 38px 38px,
    radial-gradient(120% 80% at 50% 30%, #2A4F86, #1D3358 60%, #162946);
  box-shadow: inset 0 0 0 3px #D5DDEA, inset 0 0 0 6px #E5383B, inset 0 0 0 8px #0B162B, 0 10px 24px rgba(0, 0, 0, 0.35);
}
.c8-top {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-areas: "o1 o2" "mid mid";
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  row-gap: 6px;
}
.c8-seat--1 { grid-area: o1; }
.c8-seat--2 { grid-area: o2; }
.c8-mid { grid-area: mid; --cw: calc(var(--base) * 1.2); display: flex; align-items: center; justify-content: center; gap: 14px; }

/* ---- the other players ---- */
.c8-seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 8px; }
.c8-fan { position: relative; width: calc(var(--base) * 1.7); height: calc(var(--base) * 0.86); }
.c8-back {
  display: block;
  border-radius: 12%/9%;
  background:
    repeating-conic-gradient(#E5383B 0 25%, #FFF1D6 0 50%) 50% 50% / 25% 18%,
    #E5383B;
  box-shadow: inset 0 0 0 3px #FFF1D6, inset 0 0 0 4px #13233F, 0 2px 5px rgba(0, 0, 0, 0.4);
}
.c8-fan .c8-back {
  position: absolute;
  left: 50%; bottom: 0;
  width: calc(var(--base) * 0.52);
  height: calc(var(--base) * 0.74);
  margin-left: calc(var(--base) * -0.26);
  transform-origin: 50% 135%;
  transition: transform 0.2s;
}
.c8-tag {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 5px 3px 11px;
  border-radius: 999px;
  background: rgba(11, 22, 43, 0.72);
  color: var(--parchment);
  font-size: 0.9rem; font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--hairline);
  transition: box-shadow 0.2s, background 0.2s;
}
.c8-seat.is-turn .c8-tag { background: #0B162B; box-shadow: inset 0 0 0 2px var(--gold), 0 0 14px rgba(255, 196, 61, 0.5); }
.c8-count {
  min-width: 24px; padding: 2px 6px;
  border-radius: 999px;
  background: var(--gold); color: #13233F;
  font-size: 0.86rem; font-weight: 800; text-align: center;
}
.c8-seat.is-last .c8-count { background: #E5383B; color: #FFF1D6; }
.c8-bubble {
  position: absolute; z-index: 3;
  left: 50%; top: 40%;
  transform: translate(-50%, -50%) scale(0.6);
  padding: 5px 12px;
  border-radius: 14px;
  background: #FFF1D6; color: #13233F;
  font-size: 0.9rem; font-weight: 750; white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  unicode-bidi: plaintext;
}
.c8-bubble.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.c8-bubble.is-loud { background: #E5383B; color: #FFF1D6; font-size: 1.05rem; padding: 7px 14px; box-shadow: 0 0 0 3px #FFC43D, 0 6px 14px rgba(0, 0, 0, 0.45); }
.c8-bubble.is-loud.is-on { animation: c8-ring 0.5s 2; }
.c8-bubble--me { top: -4px; }
@keyframes c8-ring { 0%, 100% { transform: translate(-50%, -50%) rotate(0); } 25% { transform: translate(-50%, -50%) rotate(-5deg) scale(1.08); } 75% { transform: translate(-50%, -50%) rotate(5deg) scale(1.08); } }

/* ---- cards ---- */
.c8-card {
  position: relative; flex: none; display: block;
  width: var(--cw); height: calc(var(--cw) * 1.4);
  padding: 0; border: 0;
  border-radius: calc(var(--cw) * 0.11);
  background: linear-gradient(160deg, #FFFDF6, #FFF1D6 70%, #F1DDB4);
  box-shadow: inset 0 0 0 1px rgba(19, 35, 63, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
button.c8-card { cursor: pointer; transition: transform 0.14s, filter 0.14s, box-shadow 0.14s; }
.c8-s0, .c8-s3 { color: #13233F; }
.c8-s1, .c8-s2 { color: #D62B2F; }
.c8-idx { position: absolute; top: 5%; left: 7%; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.c8-idx b { font-size: calc(var(--cw) * 0.36); font-weight: 800; letter-spacing: -0.04em; }
.c8-pip { width: calc(var(--cw) * 0.24); height: calc(var(--cw) * 0.24); margin-top: 2px; }
.c8-big { position: absolute; right: 8%; bottom: 7%; width: calc(var(--cw) * 0.52); height: calc(var(--cw) * 0.52); }
.c8-card--8 { box-shadow: inset 0 0 0 3px #FFC43D, inset 0 0 0 4px rgba(19, 35, 63, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4); }
.c8-card.is-ok { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--gold), 0 8px 14px rgba(0, 0, 0, 0.45); }
.c8-card.is-dim { filter: brightness(0.7); }
.c8-card.is-new { animation: c8-new 0.45s; box-shadow: 0 0 0 3px #6FB7E9, 0 6px 12px rgba(0, 0, 0, 0.45); filter: none; transform: translateY(-10px); }
.c8-card.is-no { animation: c8-no 0.3s; }
@keyframes c8-no { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes c8-new { from { transform: translateY(-60px) scale(0.8); opacity: 0; } }

/* ---- deck, pile, suit to follow ---- */
.c8-deck { position: relative; flex: none; width: var(--cw); height: calc(var(--cw) * 1.4); padding: 0; border: 0; background: none; cursor: pointer; border-radius: calc(var(--cw) * 0.11); -webkit-tap-highlight-color: transparent; }
.c8-deck .c8-back { width: 100%; height: 100%; box-shadow: inset 0 0 0 4px #FFF1D6, inset 0 0 0 5px #13233F, 2px 2px 0 #C9B58A, 4px 4px 0 #A8956C, 5px 7px 10px rgba(0, 0, 0, 0.45); }
.c8-deck .c8-count { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); }
.c8-deck.is-empty .c8-back { background: none; box-shadow: inset 0 0 0 2px rgba(255, 241, 214, 0.35); }
.c8-deck.is-need { animation: c8-need 1s infinite; }
.c8-deck:active { transform: scale(0.96); }
@keyframes c8-need { 0%, 100% { box-shadow: 0 0 0 3px var(--gold); } 50% { box-shadow: 0 0 0 9px rgba(255, 196, 61, 0.25); transform: translateY(-3px); } }
.c8-pile { position: relative; flex: none; width: var(--cw); height: calc(var(--cw) * 1.4); }
.c8-pile .c8-card { position: absolute; top: 0; left: 0; }
.c8-pile .c8-under { transform: rotate(-9deg) translate(-5px, 2px); filter: brightness(0.85); }
.c8-in--0 { animation: c8-in0 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.c8-in--1 { animation: c8-in1 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.c8-in--2 { animation: c8-in2 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
@keyframes c8-in0 { from { transform: translateY(130%) rotate(8deg); opacity: 0.4; } }
@keyframes c8-in1 { from { transform: translate(-110%, -120%) rotate(-30deg) scale(0.6); opacity: 0.4; } }
@keyframes c8-in2 { from { transform: translate(110%, -120%) rotate(30deg) scale(0.6); opacity: 0.4; } }
.c8-suit {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: calc(var(--base) * 0.66); height: calc(var(--base) * 0.66);
  min-width: 42px; min-height: 42px;
  border-radius: 50%;
  background: #FFF1D6;
  box-shadow: inset 0 0 0 3px #D5DDEA, 0 3px 8px rgba(0, 0, 0, 0.4);
}
.c8-suit__svg { width: 58%; height: 58%; }
.c8-suit.is-wild { box-shadow: inset 0 0 0 3px #FFC43D, 0 0 0 4px rgba(255, 196, 61, 0.45), 0 3px 8px rgba(0, 0, 0, 0.4); animation: c8-wild 0.5s; }
@keyframes c8-wild { 40% { transform: scale(1.35) rotate(12deg); } }

/* ---- status and the player's hand ---- */
.c8-status { flex: none; min-height: 30px; margin: 0; font-size: 0.95rem; font-weight: 600; text-align: center; color: var(--mist); unicode-bidi: plaintext; }
.c8-status.is-me { color: var(--gold-soft); }
.c8-me { position: relative; flex: none; padding: 12px 0 2px; }
.c8-hand { display: flex; flex-direction: column; align-items: center; min-height: calc(var(--cw) * 1.4); }
.c8-row { display: flex; justify-content: center; }
.c8-row + .c8-row { margin-top: calc(var(--cw) * -0.6); }

/* ---- name a suit ---- */
.c8-pick {
  position: absolute; z-index: 4;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 26px;
  background: rgba(11, 22, 43, 0.86);
  animation: c8-fade 0.2s;
}
.c8-pick[hidden] { display: none; }
.c8-pick__title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; color: var(--gold); unicode-bidi: plaintext; }
.c8-pick__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.c8-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: min(36vw, 150px); height: min(30vw, 22vh, 130px);
  padding: 0; border: 0; border-radius: 18px;
  background: linear-gradient(160deg, #FFFDF6, #FFF1D6 70%, #F1DDB4);
  box-shadow: inset 0 0 0 3px #FFC43D, 0 5px 0 #B9773B, 0 9px 14px rgba(0, 0, 0, 0.4);
  font-family: inherit; font-size: 1rem; font-weight: 750;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.c8-opt:active { transform: translateY(4px); box-shadow: inset 0 0 0 3px #FFC43D, 0 1px 0 #B9773B; }
.c8-opt__svg { width: 46%; height: 46%; max-height: 60px; }
@keyframes c8-fade { from { opacity: 0; } }

.c8-draw { min-width: 150px; }

@media (max-height: 520px) and (orientation: landscape) {
  .c8-table { --base: min(10vw, 15vh, 96px); padding-top: 8px; }
  .c8-top { grid-template-areas: "o1 mid o2"; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr; }
  .c8-status { min-height: 24px; }
  .c8-me { padding-top: 8px; }
  .c8-opt { height: min(24vh, 110px); }
}
@media (prefers-reduced-motion: reduce) {
  .c8-deck.is-need, .c8-bubble.is-loud.is-on, .c8-card.is-new, .c8-suit.is-wild { animation: none; }
}
