@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("./fonts/fraunces-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --raspberry: #f43f77;
  --tangerine: #ff8a34;
  --aqua: #16a6a1;
  --grape: #7257c7;
  --cream: #fff6e4;
  --ink: #211a32;
  --table: #242443;
  --table-deep: #17172b;
  --line: rgba(255, 246, 228, 0.15);
  --muted: #a9a5ba;
  --yellow: #ffd45d;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }
html, body { min-width: 320px; min-height: 100%; }

body {
  margin: 0;
  color: var(--cream);
  background: var(--table-deep);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.gamebar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 9px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid rgba(33, 26, 50, 0.15);
  background: rgba(255, 246, 228, 0.96);
  color: var(--ink);
  box-shadow: 0 5px 28px rgba(8, 8, 22, 0.18);
  backdrop-filter: blur(18px);
}

.studio-link, .game-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.studio-link { width: fit-content; font-family: var(--display); }
.bean-mark {
  position: relative;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: linear-gradient(145deg, #79d79e, #2f8f61);
}
.bean-mark::before, .bean-mark::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 13px;
  top: 7px;
  border-radius: 100% 0 100% 0;
  background: #143c2f;
}
.bean-mark::before { left: 7px; transform: rotate(-18deg); }
.bean-mark::after { right: 6px; transform: rotate(70deg); opacity: 0.7; }

.game-logo { font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.02em; }
.game-logo h1 { margin: 0; font: inherit; }
.logo-rainbow { display: flex; align-items: end; gap: 2px; height: 23px; transform: rotate(-8deg); }
.logo-rainbow i { width: 5px; height: 16px; border-radius: 4px; background: var(--raspberry); }
.logo-rainbow i:nth-child(2) { height: 22px; background: var(--tangerine); }
.logo-rainbow i:nth-child(3) { height: 19px; background: var(--aqua); }
.logo-rainbow i:nth-child(4) { height: 13px; background: var(--grape); }
.game-actions { display: flex; justify-content: flex-end; gap: 8px; }

.quiet-button, .new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(33, 26, 50, 0.17);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}
.quiet-button { text-decoration: none; }
.quiet-button:hover { background: rgba(33, 26, 50, 0.07); }
.rules-status { gap: 7px; }
.rules-status b {
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--grape);
  color: #fff;
  font-size: .65rem;
}
.new-button { border-color: transparent; background: var(--ink); color: var(--cream); }

.game-shell {
  min-height: calc(100dvh - 64px);
  padding: clamp(7px, 2vw, 20px);
  background:
    radial-gradient(circle at 50% 34%, rgba(114, 87, 199, 0.22), transparent 32%),
    linear-gradient(115deg, transparent 0 49.6%, rgba(255,255,255,.016) 49.7% 50.3%, transparent 50.4%) 0 0 / 26px 26px,
    var(--table-deep);
}

.game-table {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(350px, 1.6fr) minmax(130px, 0.7fr);
  grid-template-rows: 90px minmax(300px, 1fr) minmax(190px, auto);
  width: min(1320px, 100%);
  min-height: calc(100dvh - 102px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(22px, 3vw, 38px);
  background:
    radial-gradient(circle at center, rgba(255,255,255,.035) 0 1px, transparent 1.5px) 0 0 / 18px 18px,
    var(--table);
  box-shadow: inset 0 1px rgba(255,255,255,.07), 0 28px 70px rgba(5, 5, 20, 0.42);
}
.game-table::before {
  content: "";
  position: absolute;
  inset: 17px;
  z-index: -1;
  border: 1px solid var(--line);
  border-radius: clamp(15px, 2.5vw, 29px);
  pointer-events: none;
}
.game-table::after {
  content: "";
  position: absolute;
  z-index: -2;
  width: min(46vw, 580px);
  aspect-ratio: 1;
  left: 50%;
  top: 46%;
  border: 1px solid rgba(255,255,255,.045);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.opponent {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: center;
  transition: filter .2s ease, transform .2s ease;
}
.opponent-top { grid-column: 2; grid-row: 1; justify-self: center; }
.opponent-left { grid-column: 1; grid-row: 2; justify-self: start; margin-left: clamp(25px, 4vw, 56px); }
.opponent-right { grid-column: 3; grid-row: 2; justify-self: end; margin-right: clamp(25px, 4vw, 56px); flex-direction: row-reverse; text-align: right; }
.opponent.is-turn { filter: drop-shadow(0 0 13px rgba(255, 212, 93, .58)); }
.opponent.is-turn .avatar { border-color: var(--yellow); transform: scale(1.08); }
.opponent.is-eliminated { opacity: .48; filter: grayscale(.35); }
.avatar {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  flex: none;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  background: #33335a;
  font-family: var(--display);
  font-size: 1.1rem;
  transition: inherit;
}
.opponent-copy { display: grid; gap: 1px; }
.opponent-copy strong { font-family: var(--display); font-size: 1.05rem; font-weight: 560; }
.opponent-copy span { color: var(--muted); font-size: .73rem; font-weight: 750; }
.mini-hand { position: relative; width: 41px; height: 48px; margin-left: 5px; }
.mini-card {
  position: absolute;
  width: 27px;
  height: 41px;
  border: 2px solid var(--cream);
  border-radius: 6px;
  background: url("./assets/apps/rainbow-rumble/card-back-ava.png") center / cover no-repeat;
  box-shadow: 0 5px 10px rgba(0,0,0,.25);
}
.mini-card:nth-child(1) { left: 0; transform: rotate(-9deg); }
.mini-card:nth-child(2) { left: 7px; top: 1px; }
.mini-card:nth-child(3) { left: 14px; transform: rotate(9deg); }
.opponent.has-open-hand { align-items: flex-start; }
.opponent.has-open-hand .mini-hand {
  height: 48px;
}
.mini-card.mini-card-face {
  left: calc(var(--card-index) * 18px);
  top: 0;
  display: grid;
  place-items: center;
  transform: none;
  background: var(--grape);
  color: #fff;
  font-style: normal;
  font-family: var(--display);
  font-size: .58rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.32);
}
.mini-card.mini-card-face[data-color="raspberry"] { background: var(--raspberry); }
.mini-card.mini-card-face[data-color="tangerine"] { background: var(--tangerine); color: var(--ink); text-shadow: none; }
.mini-card.mini-card-face[data-color="aqua"] { background: var(--aqua); color: var(--ink); text-shadow: none; }
.mini-card.mini-card-face[data-color="grape"] { background: var(--grape); }
.mini-card.mini-card-face[data-color="wild"] {
  background: conic-gradient(var(--raspberry) 0 25%, var(--tangerine) 0 50%, var(--aqua) 0 75%, var(--grape) 0);
}

.center-play {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  min-width: 0;
}
.turn-banner {
  display: grid;
  justify-items: center;
  min-width: min(280px, 72vw);
  padding: 9px 18px 10px;
  border: 2px solid rgba(255,212,93,.72);
  border-radius: 17px;
  background: rgba(14,14,38,.88);
  box-shadow: 0 8px 28px rgba(0,0,0,.28), 0 0 28px rgba(255,212,93,.12);
  backdrop-filter: blur(8px);
}
.turn-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--yellow);
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.turn-kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255,212,93,.13);
}
.turn-banner strong {
  max-width: min(250px, 62vw);
  margin-top: 1px;
  overflow: hidden;
  font-family: var(--display);
  font-size: 1.17rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.turn-banner > span:last-child {
  max-width: 34ch;
  overflow: hidden;
  color: var(--muted);
  font-size: .66rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.piles { display: flex; align-items: center; justify-content: center; gap: clamp(28px, 5vw, 68px); }
.draw-pile {
  position: relative;
  width: 108px;
  height: 151px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
}
.stack-card, .card-back {
  position: absolute;
  inset: 0;
  border: 4px solid var(--cream);
  border-radius: 15px;
  background: var(--grape);
  box-shadow: 0 14px 35px rgba(4,4,16,.34);
}
.back-two { transform: translate(-6px, 5px) rotate(-4deg); background: #51428f; }
.back-one { transform: translate(5px, 3px) rotate(3deg); background: #403573; }
.card-back {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  overflow: hidden;
  background: url("./assets/apps/rainbow-rumble/card-back-ava.png") center / cover no-repeat;
}
.card-back > * { display: none; }
.back-burst, .result-burst {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--ink);
  background: var(--yellow);
  clip-path: polygon(50% 0,62% 17%,79% 8%,81% 29%,100% 33%,84% 47%,98% 63%,77% 68%,78% 89%,59% 79%,48% 100%,39% 80%,19% 90%,22% 69%,1% 64%,16% 48%,0 33%,20% 29%,20% 8%,40% 18%);
  font: 1000 1.45rem var(--sans);
}
.card-back b { font-family: var(--display); font-size: 1rem; font-weight: 560; line-height: .9; text-align: center; }
.draw-pile small {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: -27px;
  transform: translateX(-50%);
  color: var(--cream);
  font-size: .74rem;
  font-weight: 850;
  white-space: nowrap;
}
.draw-pile:not(:disabled):hover .card-back { transform: translateY(-5px) rotate(-1deg); }
.draw-pile:disabled { cursor: default; opacity: .68; }
.discard-wrap { display: grid; justify-items: center; gap: 10px; }
.discard-pile {
  position: relative;
  width: 108px;
  height: 151px;
  isolation: isolate;
}
.current-color {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14,14,38,.32);
  font-size: .7rem;
  font-weight: 850;
}
.direction { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.direction span { font-size: 1.2rem; }
.direction.is-reversed span { transform: scaleX(-1); }
.direction small { font-size: .68rem; font-weight: 750; }

.player-zone {
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: end;
  min-width: 0;
  padding: 5px clamp(20px, 5vw, 66px) 19px;
  background: linear-gradient(0deg, rgba(10,10,30,.33), transparent);
}
.player-meta {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  width: min(880px, 100%);
  margin: 0 auto 8px;
}
.player-meta p { margin: 0; font-family: var(--display); font-size: 1.03rem; }
.player-meta > div > span { color: var(--muted); font-size: .7rem; }
.rumble-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(14,14,38,.38);
  color: var(--cream);
  font-size: .72rem;
  font-weight: 850;
}
.rumble-button span { color: var(--yellow); font-size: 1rem; }
.rumble-button b { font: inherit; }
.rumble-button:not(:disabled):hover { border-color: var(--yellow); }
.rumble-button:disabled { opacity: .4; cursor: default; }
.rumble-button.is-called { border-color: var(--yellow); background: var(--yellow); color: var(--ink); }
.rumble-button.is-called:disabled { opacity: 1; }
.rumble-button.is-called span { color: var(--ink); }
.rumble-button.needs-call {
  border-color: var(--yellow);
  background: #fff4bd;
  color: var(--ink);
  box-shadow: 0 0 0 4px rgba(255,212,93,.18), 0 8px 24px rgba(0,0,0,.2);
  animation: rumble-pulse 1s ease-in-out infinite;
}
.rumble-button.needs-call span { color: var(--raspberry); }
@keyframes rumble-pulse {
  50% { transform: scale(1.07); box-shadow: 0 0 0 8px rgba(255,212,93,.08), 0 8px 24px rgba(0,0,0,.2); }
}
.hand-scroll {
  width: 100%;
  margin-top: -28px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 36px 0 11px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}
.player-hand { display: flex; justify-content: center; align-items: flex-end; width: fit-content; min-width: min-content; margin: 0 auto; padding: 0 30px; }

.game-card {
  --card-color: #555;
  --card-glyph-size: 2.65rem;
  position: relative;
  display: grid;
  place-items: center;
  width: 106px;
  height: 148px;
  flex: 0 0 106px;
  margin-left: -29px;
  isolation: isolate;
  z-index: 0;
  overflow: hidden;
  border: 4px solid var(--cream);
  border-radius: 15px;
  background: var(--card-color);
  color: #fff;
  box-shadow: 0 11px 29px rgba(3,3,15,.35);
  transition: transform .18s cubic-bezier(.22,1,.36,1), filter .18s ease, opacity .18s ease;
  user-select: none;
}
.game-card:first-child { margin-left: 0; }
.game-card[data-color="raspberry"] { --card-color: var(--raspberry); }
.game-card[data-color="tangerine"] { --card-color: var(--tangerine); }
.game-card[data-color="aqua"] { --card-color: var(--aqua); }
.game-card[data-color="grape"] { --card-color: var(--grape); }
.game-card::before {
  content: "";
  position: absolute;
  width: 71px;
  height: 112px;
  border: 2px solid rgba(255,255,255,.32);
  transform: rotate(12deg);
}
.game-card[data-color="raspberry"]::before { border-radius: 50%; }
.game-card[data-color="tangerine"]::before { clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 94%,50% 71%,21% 94%,32% 57%,2% 35%,39% 35%); background: rgba(255,255,255,.08); }
.game-card[data-color="aqua"]::before { border-radius: 50% 8px 50% 8px; transform: rotate(45deg); }
.game-card[data-color="grape"]::before { transform: rotate(45deg); width: 69px; height: 69px; }
.card-corner {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: .75rem;
  font-weight: 950;
  line-height: 1;
}
.card-corner.top { top: 8px; left: 8px; }
.card-corner.bottom { right: 8px; bottom: 8px; transform: rotate(180deg); }
.color-symbol { display: block; width: 9px; height: 9px; border: 1px solid currentColor; }
.game-card[data-color="raspberry"] .color-symbol { border-radius: 50%; }
.game-card[data-color="tangerine"] .color-symbol { clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 94%,50% 71%,21% 94%,32% 57%,2% 35%,39% 35%); background: currentColor; border: 0; }
.game-card[data-color="aqua"] .color-symbol { border-radius: 50% 0 50% 0; }
.game-card[data-color="grape"] .color-symbol { transform: rotate(45deg); }
.card-center {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 64px;
  min-height: 64px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(20,12,40,.16);
  font-family: var(--sans);
  font-size: var(--card-glyph-size);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.card-center.action,
.card-center.draw { font-size: var(--card-glyph-size); font-weight: 950; }
.game-card.is-legal {
  z-index: 2;
  transform: translateY(-7px);
  box-shadow:
    inset 0 0 0 3px var(--yellow),
    0 0 0 2px rgba(255, 212, 93, .82),
    0 11px 29px rgba(3,3,15,.35);
}
.game-card.is-legal:hover, .game-card.is-legal:focus-visible {
  z-index: 5;
  transform: translateY(-16px) rotate(-1deg);
  filter: brightness(1.06) saturate(1.08);
}
.game-card.is-illegal {
  filter: none;
  opacity: 1;
  cursor: not-allowed;
}
.game-card.is-drawn.is-legal {
  box-shadow:
    inset 0 0 0 4px var(--yellow),
    0 0 0 4px var(--yellow),
    0 13px 30px rgba(3,3,15,.4);
}
.game-card.has-double::after {
  content: "×2";
  position: absolute;
  z-index: 8;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 22px;
  padding: 0 5px;
  border: 2px solid var(--cream);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font: 950 .65rem var(--sans);
  box-shadow: 0 3px 8px rgba(0,0,0,.22);
}
.discard-pile .game-card {
  position: absolute;
  inset: 0;
  width: 108px;
  height: 151px;
  margin: 0;
  pointer-events: none;
  transition: none;
}
.discard-pile .discard-depth-3 { z-index: 1; transform: translate(-6px, 3px) rotate(-7deg); }
.discard-pile .discard-depth-2 { z-index: 2; transform: translate(6px, 2px) rotate(6deg); }
.discard-pile .discard-depth-1 { z-index: 3; transform: translate(-3px, 1px) rotate(-3deg); }
.discard-pile .discard-depth-0 { z-index: 4; transform: rotate(2deg); }
.robot-play-card {
  position: fixed !important;
  z-index: 100 !important;
  margin: 0 !important;
  pointer-events: none;
  will-change: transform;
  box-shadow: 0 22px 50px rgba(3,3,15,.52);
}
.opponent.is-playing-card .avatar { transform: scale(1.12); }
.opponent.is-playing-card .mini-card:first-child {
  animation: robot-card-lift .45s ease both;
}
@keyframes robot-card-lift {
  0% { transform: rotate(-9deg) translateY(0); }
  55%, 100% { transform: rotate(-13deg) translateY(-7px); }
}

/* Signature Wild cards: no black face, no oval, no four-quadrant layout. */
.game-card.wild-card { color: var(--ink); background: var(--cream); }
.game-card.wild-card::before { width: 78px; height: 116px; border: 2px solid rgba(33,26,50,.1); border-radius: 16px; transform: rotate(5deg); }
.wild-card .card-corner { color: var(--ink); }
.wild-card .color-symbol { border: 0; border-radius: 50%; background: conic-gradient(var(--raspberry) 0 25%, var(--tangerine) 0 50%, var(--aqua) 0 75%, var(--grape) 0); }
.wild-card .card-center { width: 79px; min-height: 104px; padding: 0; border-radius: 0; background: transparent; text-shadow: none; }
.game-card.wild-card:not(.wild-draw-four) {
  color: transparent;
  background: url("./assets/apps/rainbow-rumble/wild-ava.png") center / cover no-repeat;
}
.game-card.wild-card:not(.wild-draw-four)::before { display: none; }
.game-card.wild-card:not(.wild-draw-four) > * { visibility: hidden; }
.game-card.wild-draw-four {
  color: transparent;
  background: url("./assets/apps/rainbow-rumble/wild-draw-four-ava.png") center / cover no-repeat;
}
.game-card.wild-draw-four::before { display: none; }
.game-card.wild-draw-four > * { visibility: hidden; }
.wild-special { position: relative; z-index: 2; display: grid; justify-items: center; align-content: center; width: 100%; height: 100%; }
.rainbow-arch { position: relative; width: 68px; height: 38px; overflow: hidden; }
.rainbow-arch i {
  position: absolute;
  left: 50%;
  bottom: -32px;
  border: 6px solid var(--raspberry);
  border-bottom-color: transparent !important;
  border-radius: 50%;
  transform: translateX(-50%);
}
.rainbow-arch i:nth-child(1) { width: 68px; height: 68px; border-color: var(--raspberry); }
.rainbow-arch i:nth-child(2) { width: 56px; height: 56px; border-color: var(--tangerine); }
.rainbow-arch i:nth-child(3) { width: 44px; height: 44px; border-color: var(--aqua); }
.rainbow-arch i:nth-child(4) { width: 32px; height: 32px; border-color: var(--grape); }
.wild-word { margin-top: 6px; font: 950 .76rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; }

.game-dialog {
  width: min(555px, calc(100% - 30px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(33,26,50,.16);
  border-radius: 24px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 36px 100px rgba(4,4,16,.55);
}
.game-dialog::backdrop { background: rgba(7,7,22,.72); backdrop-filter: blur(7px); }
.game-dialog form { position: relative; padding: clamp(26px, 5vw, 42px); }
.dialog-close { position: absolute; top: 15px; right: 15px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(33,26,50,.16); border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.3rem; }
.dialog-eyebrow { margin: 0 0 8px; color: var(--raspberry); font-size: .68rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.game-dialog h2 { margin: 0; font: 560 clamp(1.9rem,5vw,2.7rem)/1.02 var(--display); }
.rules-dialog ol { display: grid; gap: 14px; padding: 0; margin: 26px 0; }
.rules-dialog li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; list-style: none; }
.rules-dialog li > span { color: var(--grape); font-family: var(--display); font-size: 1.05rem; }
.rules-dialog p { margin: 0; color: #655e70; font-size: .87rem; line-height: 1.5; }
.rules-dialog b { color: var(--ink); }
.fine-print { padding-top: 16px; border-top: 1px solid rgba(33,26,50,.13); }
.active-rules-summary {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 13px;
  background: #eee8ff;
}
.active-rules-summary > b { color: var(--grape); font-size: .78rem; }
.active-rules-summary ul {
  display: grid;
  gap: 9px;
  margin: 8px 0 0;
  padding: 0;
  color: #655e70;
}
.rules-dialog .active-rules-summary li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
}
.active-rules-summary li strong {
  color: var(--ink);
  font-size: .74rem;
}
.active-rules-summary li small {
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.35;
}
.dialog-primary { width: 100%; min-height: 46px; margin-top: 22px; border: 0; border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 900; }
.color-dialog { width: min(690px, calc(100% - 30px)); }
.color-dialog form {
  max-height: min(90dvh, 720px);
  overflow-y: auto;
}
.wild-hand-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}
.wild-hand-heading b { color: var(--ink); font-size: .8rem; }
.wild-hand-heading span { color: #655e70; font-size: .68rem; font-weight: 750; }
.wild-hand-scroll {
  margin-top: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(33,26,50,.13);
  border-radius: 15px;
  background: #f1e8d7;
  box-shadow: inset 14px 0 18px -20px rgba(33,26,50,.8), inset -14px 0 18px -20px rgba(33,26,50,.8);
  scrollbar-color: var(--grape) transparent;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  touch-action: pan-x;
}
.wild-hand-scroll:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.wild-hand-cards {
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  min-width: 100%;
  padding: 11px 12px 13px;
}
.wild-hand-card {
  --card-glyph-size: 1.85rem;
  width: 80px;
  height: 112px;
  flex: 0 0 80px;
  margin: 0;
  border-width: 3px;
  border-radius: 12px;
  pointer-events: none;
  scroll-snap-align: start;
  box-shadow: 0 7px 16px rgba(3,3,15,.24);
}
.wild-hand-card .card-center { min-width: 48px; min-height: 48px; }
.wild-hand-card.wild-card .card-center { width: 66px; min-height: 91px; transform: scale(.84); }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.color-grid button { display: flex; align-items: center; gap: 11px; min-height: 64px; padding: 13px; border: 1px solid rgba(33,26,50,.14); border-radius: 15px; background: #f1e8d7; color: var(--ink); text-align: left; }
.color-grid button:hover { transform: translateY(-2px); border-color: var(--ink); }
.color-grid i { width: 24px; height: 24px; border-radius: 50%; background: var(--raspberry); }
.color-grid [data-color="tangerine"] i { border-radius: 5px; background: var(--tangerine); transform: rotate(15deg); }
.color-grid [data-color="aqua"] i { border-radius: 50% 0 50% 0; background: var(--aqua); }
.color-grid [data-color="grape"] i { border-radius: 3px; background: var(--grape); transform: rotate(45deg) scale(.8); }
.color-grid b { font-family: var(--display); font-size: 1.05rem; font-weight: 560; }
.setup-dialog { width: min(510px, calc(100% - 30px)); }
.setup-dialog form {
  max-height: min(88dvh, 760px);
  overflow-y: auto;
}
.player-picker { display: grid; gap: 20px; margin-top: 26px; }
.player-picker fieldset { padding: 0; border: 0; }
.player-picker legend {
  margin-bottom: 9px;
  color: #655e70;
  font-size: .76rem;
  font-weight: 850;
}
.count-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.count-options button {
  min-height: 50px;
  border: 1px solid rgba(33,26,50,.15);
  border-radius: 13px;
  background: #f1e8d7;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}
.count-options button:hover { border-color: var(--grape); }
.count-options button.is-selected {
  border-color: var(--grape);
  background: var(--grape);
  color: #fff;
  box-shadow: 0 7px 18px rgba(114,87,199,.24);
}
.name-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.name-groups:has(> .name-group[hidden]) { grid-template-columns: 1fr; }
.name-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(33,26,50,.13);
  border-radius: 15px;
  background: rgba(241,232,215,.62);
}
.name-group[hidden] { display: none; }
.name-group legend {
  padding: 0 5px;
  color: #655e70;
  font-size: .72rem;
  font-weight: 850;
}
.name-fields { display: grid; gap: 9px; }
.name-fields label { display: grid; gap: 4px; }
.name-fields label span {
  color: #655e70;
  font-size: .66rem;
  font-weight: 800;
}
.name-fields input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(33,26,50,.18);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  font: 750 .84rem var(--sans);
}
.name-fields input:focus {
  outline: 3px solid rgba(114,87,199,.22);
  border-color: var(--grape);
}
.hand-mode-picker {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}
.hand-mode-picker legend {
  margin-bottom: 9px;
  color: #655e70;
  font-size: .76rem;
  font-weight: 850;
}
.hand-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.hand-mode-options button {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  min-height: 66px;
  padding: 11px 13px;
  border: 1px solid rgba(33,26,50,.15);
  border-radius: 13px;
  background: #f1e8d7;
  color: var(--ink);
  text-align: left;
}
.hand-mode-options button > span {
  grid-row: 1 / 3;
  align-self: center;
  font-size: 1.25rem;
}
.hand-mode-options b { align-self: end; font-size: .85rem; }
.hand-mode-options small { align-self: start; color: #655e70; font-size: .68rem; font-weight: 720; }
.hand-mode-options button.is-selected {
  border-color: var(--grape);
  background: #eee8ff;
  box-shadow: inset 0 0 0 1px var(--grape), 0 7px 18px rgba(114,87,199,.14);
}
.custom-rules-picker {
  margin: 20px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(33,26,50,.13);
  border-radius: 15px;
  background: rgba(241,232,215,.62);
}
.rule-master,
.rule-option {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 13px;
  cursor: pointer;
}
.rule-master { background: #eee8ff; }
.rule-option { grid-template-columns: 34px minmax(0,1fr) auto; }
.rule-option + .rule-option { border-top: 1px solid rgba(33,26,50,.1); }
.rule-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--grape);
  font-size: .7rem;
  font-weight: 950;
}
.rule-copy { display: grid; gap: 2px; }
.rule-copy b { font-size: .82rem; }
.rule-copy small { color: #655e70; font-size: .67rem; font-weight: 700; line-height: 1.3; }
.rule-count { color: var(--grape); font-size: .68rem; font-weight: 900; }
.rule-master input,
.rule-option input {
  width: 42px;
  height: 24px;
  margin: 0;
  accent-color: var(--grape);
}
.setup-summary {
  margin: 20px 0 0;
  color: #655e70;
  font-size: .83rem;
  text-align: center;
}
.setup-error {
  margin: 7px 0 0;
  color: #bb315f;
  font-size: .78rem;
  font-weight: 850;
  text-align: center;
}
.setup-dialog .dialog-primary:disabled { cursor: not-allowed; opacity: .45; }
.handoff-dialog { width: min(450px, calc(100% - 30px)); }
.handoff-dialog form { display: grid; justify-items: center; text-align: center; }
.handoff-lock {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 20px;
  border-radius: 50%;
  background:
    conic-gradient(var(--raspberry) 0 25%, var(--tangerine) 0 50%, var(--aqua) 0 75%, var(--grape) 0);
  color: var(--cream);
  font-size: 2rem;
  box-shadow: 0 10px 24px rgba(33,26,50,.18);
}
.handoff-dialog p:not(.dialog-eyebrow) {
  max-width: 34ch;
  margin: 13px 0 0;
  color: #655e70;
  font-size: .86rem;
  line-height: 1.5;
}
.choice-dialog,
.knockout-dialog { width: min(450px, calc(100% - 30px)); }
.choice-dialog form,
.knockout-dialog form { display: grid; justify-items: center; text-align: center; }
.choice-dialog p:not(.dialog-eyebrow),
.knockout-dialog p:not(.dialog-eyebrow) {
  max-width: 36ch;
  margin: 12px 0 0;
  color: #655e70;
  font-size: .84rem;
  line-height: 1.45;
}
.choice-card-preview {
  position: relative;
  width: 150px;
  height: 142px;
  margin-top: 17px;
}
.choice-card-preview .game-card {
  position: absolute;
  width: 88px;
  height: 123px;
  margin: 0;
  transform: rotate(-5deg) scale(.88);
  transform-origin: center bottom;
  pointer-events: none;
}
.choice-card-preview .game-card + .game-card { left: 62px; transform: rotate(5deg) scale(.88); }
.choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  margin-top: 18px;
}
.dialog-secondary {
  min-height: 48px;
  border: 1px solid rgba(33,26,50,.2);
  border-radius: 999px;
  background: #f1e8d7;
  color: var(--ink);
  font-weight: 900;
}
.stack-card-options {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin-top: 17px;
  overflow-x: auto;
  padding: 12px 8px 8px;
}
.stack-card-options .game-card {
  width: 82px;
  height: 115px;
  flex: 0 0 82px;
  margin: 0;
}
.take-penalty-button { margin-top: 17px; }
.knockout-dialog .result-burst {
  display: grid;
  place-items: center;
  font: 950 1.15rem var(--sans);
}
.result-dialog form { display: grid; justify-items: center; text-align: center; }
.result-burst { width: 74px; height: 74px; margin-bottom: 20px; font-size: 1.9rem; }
.result-dialog p:not(.dialog-eyebrow) { max-width: 36ch; margin: 12px 0 0; color: #655e70; font-size: .88rem; line-height: 1.5; }
.result-dialog a { margin-top: 16px; color: #655e70; font-size: .8rem; text-underline-offset: 3px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 22px; max-width: calc(100% - 30px); padding: 11px 16px; border-radius: 999px; background: var(--cream); color: var(--ink); box-shadow: 0 16px 45px rgba(3,3,15,.4); font-size: .78rem; font-weight: 850; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: auto 20px 20px; z-index: 100; padding: 14px; border-radius: 12px; background: #fff; color: #222; }

@media (max-width: 850px) {
  .gamebar { grid-template-columns: 1fr auto; }
  .game-logo { display: none; }
  .game-table { grid-template-columns: 100px minmax(260px,1fr) 100px; grid-template-rows: 78px minmax(280px,1fr) minmax(178px,auto); }
  .opponent-left { margin-left: 18px; }
  .opponent-right { margin-right: 18px; }
  .opponent-copy, .mini-hand { display: none; }
  .opponent.has-open-hand { position: relative; align-items: center; }
  .opponent.has-open-hand .mini-hand {
    position: absolute;
    top: 48px;
    left: 0;
    display: block;
    transform: scale(.68);
    transform-origin: left top;
  }
  .opponent-right.has-open-hand .mini-hand {
    right: 0;
    left: auto;
    transform-origin: right top;
  }
  .opponent-top.has-open-hand .mini-hand {
    left: 50%;
    transform: translateX(-50%) scale(.68);
    transform-origin: center top;
  }
  .avatar { position: relative; }
  .avatar::after { content: attr(data-count); position: absolute; display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 4px; transform: translate(16px,16px); border: 2px solid var(--table); border-radius: 50%; background: var(--cream); color: var(--ink); font: 850 .65rem var(--sans); }
  .draw-pile, .discard-pile, .discard-pile .game-card { width: 94px; height: 132px; }
  .game-card { --card-glyph-size: 2.2rem; width: 94px; height: 132px; flex-basis: 94px; margin-left: -28px; }
  .card-center { min-width: 56px; min-height: 56px; }
}

@media (max-width: 590px) {
  .gamebar { min-height: 58px; }
  .studio-link span:last-child { display: none; }
  .quiet-button, .new-button { padding-inline: 10px; }
  .game-shell { min-height: calc(100dvh - 58px); padding: 6px; }
  .game-table { grid-template-columns: 70px minmax(180px,1fr) 70px; grid-template-rows: 66px minmax(245px,1fr) minmax(168px,auto); min-height: calc(100dvh - 70px); border-radius: 18px; }
  .game-table::before { inset: 10px; border-radius: 12px; }
  .opponent-left { margin-left: 12px; }
  .opponent-right { margin-right: 12px; }
  .avatar { width: 38px; height: 38px; font-size: .95rem; }
  .piles { gap: 28px; }
  .draw-pile, .discard-pile, .discard-pile .game-card { width: 82px; height: 115px; }
  .stack-card, .card-back, .game-card { border-width: 3px; border-radius: 12px; }
  .discard-pile .card-center { min-width: 46px; min-height: 46px; font-size: 1.8rem; }
  .discard-pile .wild-card .card-center { min-width: 64px; min-height: 91px; transform: scale(.78); }
  .direction { display: none; }
  .player-zone { padding: 3px 9px 11px; }
  .player-meta { padding-inline: 4px; }
  .player-meta > div > span { display: block; max-width: 205px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rumble-button { width: 38px; justify-content: center; padding-inline: 0; font-size: 0; }
  .rumble-button.needs-call,
  .rumble-button.is-called { width: auto; padding-inline: 12px; font-size: .72rem; }
  .game-card { --card-glyph-size: 1.95rem; width: 85px; height: 119px; flex-basis: 85px; margin-left: -31px; }
  .player-hand { padding-inline: 24px; }
  .card-center { min-width: 49px; min-height: 49px; }
  .wild-card .card-center { width: 69px; min-height: 93px; transform: scale(.88); }
  .color-dialog { width: calc(100% - 12px); margin: auto 6px 6px; border-radius: 22px 22px 16px 16px; }
  .color-dialog form { max-height: 88dvh; padding: 22px 18px 18px; }
  .color-dialog .color-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .color-dialog .color-grid button { min-height: 54px; padding: 10px; }
  .wild-hand-heading { align-items: flex-start; }
  .wild-hand-heading span { max-width: 16ch; text-align: right; }
  .wild-hand-card { width: 76px; height: 106px; flex-basis: 76px; }
  .name-groups { grid-template-columns: 1fr; }
  .hand-mode-options { grid-template-columns: 1fr; }
  .rule-count { display: none; }
  .rule-master { grid-template-columns: 34px minmax(0,1fr) auto; }
  .choice-dialog,
  .knockout-dialog { width: calc(100% - 12px); margin: auto 6px 6px; border-radius: 22px 22px 16px 16px; }
  .choice-dialog form,
  .knockout-dialog form { max-height: 82dvh; overflow-y: auto; padding: 22px 18px 18px; }
  .choice-actions { grid-template-columns: 1fr; }
}

@media (max-height: 700px) and (min-width: 700px) {
  .game-table { grid-template-rows: 64px minmax(242px,1fr) 158px; }
  .draw-pile, .discard-pile, .discard-pile .game-card { width: 88px; height: 123px; }
  .game-card { width: 88px; height: 123px; flex-basis: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
