/* CRAZY EIGHTS — a Btown Games production. Green-mountain felt, maple backs. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pine: #123524;        /* darkest green — chrome, borders, text on gold */
  --pine-2: #1b4a31;
  --felt: #226b40;        /* the table */
  --felt-glow: #2e8149;
  --cream: #f6efdc;
  --cream-dim: #d9ccae;
  --sun: #f2a24a;         /* fleet gold */
  --maple: #b5542a;       /* card backs */
  --maple-deep: #8f3d1f;
  --card-red: #c0392b;
  --card-black: #1d2733;
  --card-w: clamp(58px, 17vw, 80px);
}

html, body {
  height: 100%;
  overscroll-behavior: none;
  background: var(--pine);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#app { position: fixed; inset: 0; overflow: hidden; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- screens */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(242, 162, 74, 0.14), transparent 55%),
    radial-gradient(100% 100% at 50% 110%, var(--felt-glow), transparent 70%),
    linear-gradient(180deg, var(--pine) 0%, var(--pine-2) 55%, var(--felt) 100%);
}

/* Church Street in autumn glowing faintly behind the title — Burlington's
 * own maples, from the where-in-btown photo collection. */
#menu {
  background:
    linear-gradient(180deg, rgba(18, 53, 36, 0.86) 0%, rgba(18, 53, 36, 0.62) 42%,
      rgba(16, 44, 29, 0.78) 74%, rgba(18, 53, 36, 0.94) 100%),
    url("img/church-street-autumn.jpg") center 28% / cover no-repeat,
    var(--pine);
}

.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.4vh;
  width: 100%;
  max-width: 420px;
  flex: 1;
  justify-content: center;
  min-height: 0;
}

/* wordmark */
#logo { text-align: center; user-select: none; }
.l-crazy {
  display: block;
  font-size: clamp(20px, 3.4vh, 30px);
  font-weight: 900;
  letter-spacing: 0.55em;
  margin-left: 0.55em;
  color: var(--sun);
  text-shadow: 0 2px 0 rgba(18, 53, 36, 0.9);
}
.l-eights { display: block; margin-top: 0.5vh; }
.l-eights i {
  display: inline-block;
  font-style: normal;
  font-weight: 900;
  font-size: clamp(42px, min(10.5vh, 15vw), 92px);
  line-height: 1;
  color: var(--cream);
  -webkit-text-stroke: 2.5px var(--pine);
  text-shadow:
    0 2px 0 var(--pine), 0 4px 0 var(--pine), 0 6px 0 var(--pine),
    0 8px 0 rgba(18, 53, 36, 0.7), 0 14px 26px rgba(0, 0, 0, 0.55);
  animation: shuffle-bob 2.4s ease-in-out infinite;
}
.l-eights i:nth-child(odd) { color: #ffd9a0; }
.l-eights i:nth-child(2) { animation-delay: 0.12s; }
.l-eights i:nth-child(3) { animation-delay: 0.24s; }
.l-eights i:nth-child(4) { animation-delay: 0.36s; }
.l-eights i:nth-child(5) { animation-delay: 0.48s; }
.l-eights i:nth-child(6) { animation-delay: 0.6s; }
@keyframes shuffle-bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}
.l-deck {
  display: block;
  margin-top: 1.2vh;
  font-size: clamp(12px, 1.8vh, 15px);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(18, 53, 36, 0.9);
}

#tagline {
  text-align: center;
  color: var(--cream);
  font-size: clamp(13px, 2vh, 16px);
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(18, 53, 36, 0.8);
}

.big-btn {
  font-size: clamp(17px, 2.6vh, 22px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--pine);
  background: linear-gradient(180deg, #ffc24e, var(--sun));
  border: 3px solid var(--pine);
  border-radius: 16px;
  padding: 14px 30px;
  box-shadow: 0 5px 0 var(--pine), 0 10px 22px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s ease;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--pine); }

.mode-btn {
  font-size: clamp(14px, 2.2vh, 18px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cream);
  background: rgba(246, 239, 220, 0.08);
  border: 2.5px solid rgba(246, 239, 220, 0.35);
  border-radius: 14px;
  padding: 12px 26px;
  cursor: pointer;
  touch-action: manipulation;
}
.mode-btn:active { background: rgba(246, 239, 220, 0.2); }

#passSetup { display: flex; flex-direction: column; align-items: center; gap: 1.4vh; }
.count-label {
  display: block;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--cream-dim);
  margin-bottom: 8px;
}
.count-btns { display: flex; gap: 10px; justify-content: center; }
.count-btn {
  width: 56px; height: 56px;
  font-size: 24px;
  font-weight: 900;
  color: var(--pine);
  background: var(--cream);
  border: 3px solid var(--pine);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--pine);
  cursor: pointer;
  touch-action: manipulation;
}
.count-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--pine); }

#onlineSetup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: min(100%, 380px);
}
.online-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(18, 53, 36, 0.9);
}
#onlineRow {
  display: flex;
  gap: 9px;
  width: 100%;
}
#onlineRow .mode-btn {
  flex: 1;
  min-height: 52px;
  padding: 8px 10px;
}
.online-name, .online-blurb { display: block; }
.online-name { font-size: 12px; font-weight: 900; }
.online-blurb {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream-dim);
}
#rejoinBtn { margin-top: 2px; }

#howto { text-align: center; display: flex; flex-direction: column; gap: 7px; }
.howto-line { font-size: 12px; color: var(--cream-dim); font-weight: 600; }
#howto .key {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--cream);
  border: 1.5px solid rgba(246, 239, 220, 0.4);
  border-radius: 8px;
  padding: 3px 9px;
  margin-right: 7px;
  background: rgba(18, 53, 36, 0.5);
}

#credit, #credit-go {
  flex: none;
  text-align: center;
  font-size: 12px;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(18, 53, 36, 0.9);
  padding-bottom: 4px;
}
#credit a, #credit-go a { color: var(--sun); font-weight: 700; text-decoration: none; }
#credit a:active, #credit-go a:active { text-decoration: underline; }

/* ---------------------------------------------------------------- handoff */

.handoff-card {
  width: min(92vw, 380px);
  background: linear-gradient(180deg, rgba(27, 74, 49, 0.97), rgba(18, 53, 36, 0.97));
  border: 2.5px solid rgba(246, 239, 220, 0.25);
  border-radius: 22px;
  padding: 30px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow:
    inset 0 1px 0 rgba(246, 239, 220, 0.18),
    0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.handoff-emoji { font-size: 46px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
#handoffTitle {
  font-size: clamp(20px, 3.4vh, 26px);
  font-weight: 900;
  color: var(--cream);
}
.handoff-sub { font-size: 13px; color: var(--cream-dim); font-style: italic; }

/* ---------------------------------------------------------------- table */

#game {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
  background:
    radial-gradient(130% 90% at 50% 30%, var(--felt) 0%, var(--pine-2) 78%, var(--pine) 100%);
}
/* felt grain */
#game::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
}
/* soft vignette so the table reads as a lit surface */
#game::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 130px 30px rgba(6, 18, 12, 0.55);
}

/* Green Mountains skyline along the top of the felt */
#mountains {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 120px;
  pointer-events: none;
  opacity: 0.45;
  background: #0d2a1b;
  clip-path: polygon(0 100%, 0 58%, 11% 26%, 23% 62%, 37% 18%, 50% 66%, 63% 30%, 75% 70%, 88% 34%, 100% 60%, 100% 100%);
}

#topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
}
#homeBtn, #mute {
  flex: none;
  font-size: 17px;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(246, 239, 220, 0.25);
  background: rgba(18, 53, 36, 0.55);
  color: var(--cream);
  cursor: pointer;
  touch-action: manipulation;
}
#homeBtn:focus-visible,
#mute:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

#opponents {
  flex: 1;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.opp {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(18, 53, 36, 0.55);
  border: 2px solid rgba(246, 239, 220, 0.18);
  color: var(--cream);
  font-size: 13px;
  font-weight: 800;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.opp .opp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 30px;
  padding: 0 4px;
  border-radius: 5px;
  background: linear-gradient(160deg, var(--maple), var(--maple-deep));
  border: 1.5px solid rgba(246, 239, 220, 0.55);
  font-size: 13px;
  font-weight: 900;
  color: var(--cream);
}
.opp.active {
  border-color: var(--sun);
  box-shadow: 0 0 0 2px rgba(242, 162, 74, 0.35), 0 0 18px rgba(242, 162, 74, 0.35);
}

#table {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 0;
}

#table { perspective: 1100px; }
#piles {
  display: flex;
  align-items: center;
  gap: clamp(18px, 7vw, 40px);
  transform: rotateX(9deg);
  transform-style: preserve-3d;
}

/* stock */
#stockWrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#stock {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  cursor: pointer;
  touch-action: manipulation;
}
.cardback {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 42%, rgba(246, 239, 220, 0.16) 0 26%, transparent 27%),
    repeating-linear-gradient(45deg, rgba(246, 239, 220, 0.06) 0 3px, transparent 3px 9px),
    linear-gradient(160deg, #c2603a, var(--maple) 45%, var(--maple-deep));
  border: 2.5px solid var(--cream);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--card-w) * 0.42);
}
.cardback.under { z-index: -1; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.cardback.under span { display: none; }
.cardback.u1 { transform: translate(2.5px, 2.5px); }
.cardback.u2 { transform: translate(5px, 5px); }
.cardback.u3 { transform: translate(7.5px, 7.5px); }
#stock.drawable .cardback:first-child { animation: beckon 1.4s ease-in-out infinite; }
@keyframes beckon {
  0%, 100% { transform: translateY(0); box-shadow: 0 3px 10px rgba(0,0,0,0.4); }
  50% { transform: translateY(-7px); box-shadow: 0 10px 18px rgba(0,0,0,0.45), 0 0 16px rgba(242,162,74,0.5); }
}
#stock.empty .cardback { opacity: 0.35; }
#stock.bump-1 { animation: stock-bump-1 0.2s ease-out; }
#stock.bump-2 { animation: stock-bump-2 0.24s ease-out; }
#stock.bump-3 { animation: stock-bump-3 0.3s ease-out; }
@keyframes stock-bump-1 { 40% { transform: scale(0.95) rotate(-1deg); } }
@keyframes stock-bump-2 {
  30% { transform: translateX(-3px) scale(0.94) rotate(-2deg); }
  65% { transform: translateX(3px) rotate(1deg); }
}
@keyframes stock-bump-3 {
  20% { transform: translateX(-5px) scale(0.92) rotate(-3deg); }
  45% { transform: translateX(5px) rotate(2deg); }
  70% { transform: translateX(-3px) rotate(-1deg); }
}
#stockCount {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--cream-dim);
}

/* discard + suit badge */
#discardWrap { position: relative; display: flex; align-items: center; gap: 12px; }
#discard { width: var(--card-w); aspect-ratio: 5 / 7; position: relative; }
#discard .card { position: absolute; inset: 0; margin: 0; }
/* earlier plays peeking out under the top card — a real pile */
#discard .card.under {
  filter: brightness(0.88) saturate(0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
#discard .card.slap { animation: slap 0.23s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes slap {
  0% { transform: scale(1.35) rotate(-9deg) translateY(-26px); box-shadow: 0 30px 40px rgba(0,0,0,0.5); }
  100% { transform: scale(1) rotate(0) translateY(0); }
}

/* the suit-to-match marker, styled like a poker chip on the felt */
#suitBadge {
  width: 50px; height: 50px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #fffdf2 0 58%, var(--cream) 59% 66%, transparent 67%),
    repeating-conic-gradient(var(--cream) 0deg 16deg, var(--maple) 16deg 32deg);
  border: 2px solid var(--pine);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.6),
    0 4px 0 rgba(18, 53, 36, 0.9),
    0 8px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}
#suitBadge.red { color: var(--card-red); }
#suitBadge.black { color: var(--card-black); }
#suitBadge.pulse { animation: badge-pulse 0.5s ease-out; }
@keyframes badge-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); box-shadow: 0 0 0 8px rgba(242, 162, 74, 0.4); }
  100% { transform: scale(1); }
}

#msg {
  min-height: 1.4em;
  padding: 0 18px;
  text-align: center;
  font-size: clamp(13px, 2vh, 16px);
  font-weight: 650;
  color: var(--cream-dim);
  text-shadow: 0 1px 4px rgba(18, 53, 36, 0.9);
  opacity: 0;
}
#msg.fresh {
  animation: narration-fade 2.8s ease forwards;
}
@keyframes narration-fade {
  0%, 68% { opacity: 1; }
  100% { opacity: 0; }
}

.chip-btn {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cream);
  background: rgba(246, 239, 220, 0.1);
  border: 2px solid rgba(246, 239, 220, 0.3);
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.chip-btn:active { background: rgba(246, 239, 220, 0.22); }

/* ---------------------------------------------------------------- hand */

#handArea {
  position: relative;
  z-index: 2;
  flex: none;
  padding-top: 18px; /* headroom for lifted playable cards */
}
#requirement {
  width: fit-content;
  max-width: calc(100vw - 24px);
  min-height: 28px;
  margin: 0 auto 7px;
  padding: 5px 12px;
  border: 1.5px solid rgba(246, 239, 220, 0.24);
  border-radius: 999px;
  background: rgba(18, 53, 36, 0.62);
  color: var(--cream);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
#requirement .red { color: #ff9f8d; }
#handLabel {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--cream-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
}
#hand {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
  min-height: calc(var(--card-w) * 1.4 + 46px);
}
#hand::-webkit-scrollbar { display: none; }
/* centering trick: margins auto on the ends so short hands sit centered */
#hand::before, #hand::after { content: ""; margin: auto; }
/* big hands wrap into a flat two-row rack (JS adds .wrap + a .hand-break);
 * side padding shrinks to 6px to buy row width — keep in sync with main.js */
#hand.wrap {
  flex-wrap: wrap;
  justify-content: center;
  padding-left: 6px;
  padding-right: 6px;
}
#hand.wrap::before, #hand.wrap::after { content: none; }
.hand-break { flex: 1 0 100%; height: 10px; }

.card {
  flex: none;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%),
    linear-gradient(168deg, #ffffff 0%, #faf5e6 55%, #ede4ca 100%);
  border: 1px solid #d6ccae;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(148, 132, 96, 0.35),
    -4px 6px 10px rgba(0, 0, 0, 0.3),
    -1px 2px 3px rgba(0, 0, 0, 0.22);
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* JS sets --fan-ml per hand so every card keeps a ≥44px tappable strip;
 * the calc() below is only the pre-JS fallback */
#hand .card + .card { margin-left: var(--fan-ml, calc(var(--card-w) * -0.44)); }
/* the fan: JS sets --rot and --arc per card; playable cards rise out of it */
#hand .card {
  --lift: 4px;
  transform: translateY(calc(var(--arc, 0px) + var(--lift))) rotate(var(--rot, 0deg));
  transform-origin: 50% 130%;
}
#hand .card.playable {
  --lift: -14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    -4px 10px 16px rgba(0, 0, 0, 0.42),
    0 0 16px rgba(242, 162, 74, 0.6);
  border-color: var(--sun);
  z-index: 1;
}
#hand .card.deal-in { animation: deal-in 0.34s ease-out backwards; }
@keyframes deal-in {
  from { transform: translateY(80px) rotate(10deg); opacity: 0; }
}
#hand .card.nope { animation: nope 0.3s ease; }
@keyframes nope {
  25% { transform: translateY(6px) translateX(-5px) rotate(-3deg); }
  75% { transform: translateY(6px) translateX(5px) rotate(3deg); }
}
.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }

.card .corner {
  position: absolute;
  top: 5px; left: 6px;
  font-size: calc(var(--card-w) * 0.24);
  font-weight: 900;
  line-height: 1.02;
  text-align: center;
}
.card .corner.flip {
  top: auto; left: auto;
  bottom: 5px; right: 6px;
  transform: rotate(180deg);
}
.card .pip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--card-w) * 0.52);
}
.card .pip .eight-wild {
  font-size: calc(var(--card-w) * 0.5);
  font-weight: 900;
  -webkit-text-stroke: 1px currentColor;
}

/* ---------------------------------------------------------------- overlays */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(10, 30, 19, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-card {
  background: linear-gradient(180deg, rgba(27, 74, 49, 0.98), rgba(18, 53, 36, 0.98));
  border: 2.5px solid rgba(246, 239, 220, 0.3);
  border-radius: 20px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.picker-title { font-size: 16px; font-weight: 900; color: var(--cream); }
.picker-suits { display: flex; gap: 12px; }
.suit-btn {
  width: 62px; height: 62px;
  font-size: 34px;
  border-radius: 14px;
  background: var(--cream);
  border: 3px solid var(--pine);
  box-shadow: 0 4px 0 var(--pine);
  color: var(--card-black);
  cursor: pointer;
  touch-action: manipulation;
}
.suit-btn.red { color: var(--card-red); }
.suit-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--pine); }

/* ------------------------------------------------------------ online play */

#onlinePanel, #lobby {
  position: fixed;
  padding: 20px;
  background: rgba(10, 30, 19, 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.op-card {
  width: min(92vw, 350px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 18px;
  background: linear-gradient(180deg, var(--pine-2), var(--pine));
  border: 2.5px solid rgba(246, 239, 220, 0.3);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color: var(--cream);
  text-align: center;
}
.op-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.op-label, .lobby-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--cream-dim);
}
.op-label { text-align: left; margin-bottom: -6px; }
.op-card input {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(10, 30, 19, 0.68);
  border: 2px solid rgba(246, 239, 220, 0.3);
  border-radius: 12px;
  outline: none;
  text-align: center;
  -webkit-user-select: text;
  user-select: text;
}
.op-card input:focus { border-color: var(--sun); }
#opCode { letter-spacing: 0.4em; text-transform: uppercase; font-size: 24px; }
.op-error {
  font-size: 13px;
  font-weight: 700;
  color: #ffb09c;
}
.op-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 4px;
}
.op-btns .big-btn { min-height: 48px; font-size: 16px; padding: 10px 22px; }
.seat-btns { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.seat-btn {
  width: 52px;
  height: 48px;
  border: 2px solid rgba(246, 239, 220, 0.35);
  border-radius: 12px;
  background: rgba(246, 239, 220, 0.1);
  color: var(--cream);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}
.seat-btn.selected {
  color: var(--pine);
  background: var(--sun);
  border-color: var(--cream);
}
#lobbyCode {
  padding: 6px 0;
  color: var(--sun);
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-shadow: 0 3px 0 var(--pine);
  animation: lobbyPulse 1.6s ease-in-out infinite;
}
@keyframes lobbyPulse { 50% { opacity: 0.75; } }
#lobbyHint { font-size: 13px; color: var(--cream-dim); }
#lobbyNames {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}
#lobbyNames li {
  min-height: 34px;
  padding: 7px 10px;
  border: 1.5px solid rgba(246, 239, 220, 0.2);
  border-radius: 10px;
  background: rgba(246, 239, 220, 0.08);
  color: var(--cream);
  font-size: 13px;
  font-weight: 800;
}
#homeBtn.leave-armed { width: auto; padding: 0 10px; color: var(--cream); font-weight: 900; }

#suitBanner {
  position: absolute;
  top: 38%;
  left: 0; right: 0;
  z-index: 45;
  text-align: center;
  font-size: clamp(22px, 4.4vh, 34px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--cream);
  text-shadow: 0 3px 0 var(--pine), 0 6px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: banner 1.5s ease forwards;
}
#suitBanner .big-suit { font-size: 1.35em; vertical-align: -0.12em; }
#suitBanner .red { color: #ff8f7a; }
@keyframes banner {
  0% { opacity: 0; transform: scale(0.6); }
  18% { opacity: 1; transform: scale(1.08); }
  30% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}

/* ---------------------------------------------------- non-blocking effects */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#fxBanner {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 42%;
  width: min(88vw, 360px);
  transform: translate(-50%, -50%);
  padding: 13px 17px;
  border: 3px solid #ffe29a;
  border-radius: 15px;
  background: linear-gradient(180deg, #ffc552, var(--sun));
  box-shadow: 0 8px 0 var(--pine), 0 20px 45px rgba(0, 0, 0, 0.48);
  color: var(--pine);
  font-size: clamp(21px, 6vw, 29px);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
}
#fxBanner.show {
  display: block !important;
  animation: one-card-banner 1.35s ease forwards;
}
@keyframes one-card-banner {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.72) rotate(-2deg); }
  16%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(0.98); }
}

.opp.one-card,
#handLabel.one-card {
  color: #fff0b8;
  border-color: var(--sun);
  animation: one-card-pulse 0.7s ease-in-out 2;
}
@keyframes one-card-pulse {
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 0 5px rgba(242, 162, 74, 0.2), 0 0 24px rgba(242, 162, 74, 0.65);
  }
}

/* ---------------------------------------------------------------- game over */

#gameover {
  background:
    linear-gradient(180deg, rgba(10, 24, 15, 0.8), rgba(10, 24, 15, 0.62) 50%, rgba(10, 24, 15, 0.85)),
    url("img/church-street-autumn.jpg") center 40% / cover no-repeat,
    var(--pine);
}
#go-card {
  width: min(92vw, 400px);
  background: linear-gradient(180deg, rgba(27, 74, 49, 0.94), rgba(18, 53, 36, 0.96));
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border: 2.5px solid rgba(246, 239, 220, 0.22);
  border-radius: 22px;
  padding: 24px 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow:
    inset 0 1px 0 rgba(246, 239, 220, 0.18),
    0 24px 60px rgba(0, 0, 0, 0.6),
    0 6px 18px rgba(0, 0, 0, 0.45);
  text-align: center;
}
#go-title {
  font-size: clamp(24px, 4.2vh, 34px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--sun);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
}
#gameover.resolving #go-title {
  animation: result-title-in 0.5s cubic-bezier(0.2, 1.35, 0.4, 1);
}
@keyframes result-title-in {
  from { opacity: 0; transform: rotate(-4deg) translateY(-18px) scale(0.58); }
  to { opacity: 1; transform: rotate(-2deg) translateY(0) scale(1); }
}
#go-line {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--cream);
}
#go-btns { display: flex; gap: 10px; align-items: center; }
#go-btns .big-btn { padding: 11px 26px; font-size: 17px; }

#brief-cta {
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--cream);
  font-size: 13px;
  line-height: 1.5;
  background: linear-gradient(180deg, rgba(242, 162, 74, 0.22), rgba(242, 162, 74, 0.12));
  border: 2px solid rgba(242, 162, 74, 0.55);
  border-radius: 14px;
  padding: 10px 18px;
  width: 100%;
}
#brief-cta strong { color: #ffd9a0; font-size: 14px; }
#brief-cta:active { background: rgba(242, 162, 74, 0.3); }

/* ---------------------------------------------------------- leaderboard */

#lb {
  width: 100%;
  background: rgba(246, 239, 220, 0.07);
  border: 2px solid rgba(246, 239, 220, 0.22);
  border-radius: 14px;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lb-tabs { display: flex; gap: 8px; }
.lb-tabs .chip-btn { padding: 7px 12px; opacity: 0.65; }
.lb-tabs .chip-btn.sel {
  opacity: 1;
  color: var(--pine);
  background: var(--sun);
  border-color: var(--sun);
}
.lb-status {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--cream-dim);
  text-align: center;
  min-height: 15px;
}
#lbList {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#lbList li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
  padding: 3px 8px;
  border-radius: 8px;
}
#lbList li.me { background: rgba(242, 162, 74, 0.2); color: #ffd9a0; }
#lbList .rank { width: 26px; text-align: center; }
#lbList .nm {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#lbList .sc { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-form { display: flex; gap: 8px; width: 100%; }
.lb-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  color: var(--cream);
  background: rgba(246, 239, 220, 0.1);
  border: 2px solid rgba(246, 239, 220, 0.3);
  border-radius: 10px;
  outline: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  user-select: text;
}
.lb-form input:focus { border-color: var(--sun); }
.lb-rename { padding: 6px 12px; font-size: 11px; }

/* Champ surfaces with a gracious or cheeky post-hand line in bot mode. */
#champ {
  position: absolute;
  right: 2%;
  bottom: calc(env(safe-area-inset-bottom, 0px) - 5px);
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  animation: champ-up 0.58s cubic-bezier(0.2, 1.4, 0.4, 1);
}
#champSvg {
  width: clamp(82px, 15vh, 132px);
  height: auto;
  transform: scaleX(-1);
  filter: drop-shadow(0 7px 8px rgba(0, 0, 0, 0.35));
}
#champBubble {
  max-width: min(210px, 58vw);
  margin-right: 38%;
  margin-bottom: 3px;
  padding: 8px 12px;
  border-radius: 14px 14px 3px 14px;
  background: var(--cream);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.42);
  color: var(--pine);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  animation: champ-bubble-in 0.3s ease-out 0.35s backwards;
}
@keyframes champ-up {
  from { transform: translateY(110%); }
}
@keyframes champ-bubble-in {
  from { opacity: 0; transform: scale(0); }
}

/* ---------------------------------------------------------------- desktop */

@media (min-width: 700px) {
  :root { --card-w: 92px; }
  #hand { justify-content: center; }
}

@media (max-height: 720px) {
  .menu-inner { gap: 1.35vh; }
  .l-deck { margin-top: 0.5vh; }
  #howto { gap: 4px; }
  .howto-line { font-size: 11px; }
}

/* Motion-sensitive players keep all status text without travel, shake,
   pulsing, or spring effects. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  #fxBanner.show {
    opacity: 1;
    transform: translate(-50%, -50%);
    animation: none !important;
  }
  #msg.fresh {
    opacity: 1;
    animation: none !important;
  }
  #gameover.resolving #go-title {
    opacity: 1;
    transform: rotate(-2deg);
    animation: none !important;
  }
  .opp.one-card,
  #handLabel.one-card {
    box-shadow: 0 0 0 3px rgba(242, 162, 74, 0.55);
    animation: none !important;
  }
}
