:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #1f211c;
  background: #5c2f12;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(66, 32, 9, 0.08), rgba(66, 32, 9, 0.18)),
    #7f3e14 url("/assets/table/wood-background.png") center / cover fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 8px 14px 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  margin-bottom: 10px;
  padding: 10px 16px;
  border: 1px solid rgba(106, 255, 128, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 21, 18, 0.97), rgba(24, 35, 27, 0.93)),
    #141812;
  box-shadow:
    0 10px 24px rgba(53, 31, 14, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f4fff5;
}

.title-block h1 {
  display: inline-block;
  position: relative;
  margin: 0;
  background:
    linear-gradient(90deg, #fff3be 0%, #85ff72 42%, #2ed45f 72%, #fff8cf 100%);
  color: transparent;
  font-family:
    "Trebuchet MS", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.45rem, 2.5vw, 2.2rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: uppercase;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0.8px rgba(6, 11, 7, 0.82);
  filter:
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 12px rgba(53, 218, 94, 0.24));
}

.title-block h1::after {
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 211, 88, 0.95), rgba(47, 222, 96, 0.95));
  content: "";
  box-shadow: 0 0 12px rgba(55, 222, 101, 0.38);
}

.title-block p {
  margin: 8px 0 0;
  color: #cce3d0;
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.topbar-side {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.topbar .pill {
  border-color: rgba(106, 255, 128, 0.24);
  background: rgba(47, 222, 96, 0.12);
  color: #eaffee;
}

.topbar-leave-button {
  min-height: 34px;
  padding: 7px 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(15, 54, 39, 0.18);
  border-radius: 999px;
  background: rgba(16, 108, 75, 0.12);
  color: #103626;
  font-size: 0.84rem;
  font-weight: 850;
  white-space: nowrap;
}

.notice {
  min-height: 40px;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(126, 81, 21, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #141612;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 8px 18px rgba(53, 31, 14, 0.12);
}

.notice:empty {
  display: none;
}

.main-menu-screen,
.multiplayer-screen {
  display: grid;
  gap: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-button {
  display: grid;
  min-height: 150px;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border: 1px solid rgba(255, 239, 187, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(11, 41, 31, 0.96), rgba(39, 78, 50, 0.94)),
    #163528;
  padding: 18px;
  color: #fff9df;
  text-align: left;
  box-shadow:
    0 18px 34px rgba(53, 31, 14, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mode-button:hover {
  border-color: rgba(255, 214, 105, 0.72);
  background:
    linear-gradient(135deg, rgba(15, 70, 47, 0.98), rgba(64, 101, 47, 0.96)),
    #17452d;
}

.mode-button strong {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 950;
}

.mode-button span {
  color: #cfe5cf;
  font-size: 0.95rem;
  font-weight: 850;
}

.room-list {
  display: grid;
  gap: 10px;
}

.room-card {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #d7ddd5;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  color: #17221e;
  text-align: left;
}

.room-card:hover:not(:disabled) {
  border-color: #15734f;
  box-shadow: 0 0 0 2px rgba(21, 115, 79, 0.16);
}

.room-card.disabled {
  opacity: 0.66;
}

.room-card-main {
  display: grid;
  gap: 3px;
}

.room-card-main strong {
  color: #0d4d33;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.room-card-main span {
  overflow: hidden;
  color: #5f665e;
  font-size: 0.84rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.room-card-stats span {
  min-height: 28px;
  border: 1px solid rgba(15, 54, 39, 0.16);
  border-radius: 999px;
  background: rgba(16, 108, 75, 0.09);
  padding: 5px 9px;
  color: #1d3f32;
  font-size: 0.78rem;
  font-weight: 850;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid rgba(45, 36, 23, 0.14);
  border-radius: 8px;
  background: rgba(250, 247, 238, 0.96);
  box-shadow: 0 18px 36px rgba(53, 31, 14, 0.2);
}

.panel-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(45, 36, 23, 0.12);
}

.panel-header h1,
.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.panel-body {
  padding: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 850;
  color: #343a34;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b8c1b9;
  border-radius: 6px;
  background: #ffffff;
  color: #161a16;
  padding: 8px 10px;
}

.bot-preview {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #d7ddd5;
  border-radius: 8px;
  background: #ffffff;
}

.bot-preview span {
  color: #5f665e;
  font-size: 0.9rem;
  font-weight: 750;
}

.online-divider {
  height: 1px;
  margin: 2px 0;
  background: rgba(45, 36, 23, 0.14);
}

.room-code-box {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(21, 115, 79, 0.18);
  border-radius: 8px;
  background: rgba(16, 108, 75, 0.1);
}

.room-code-box span {
  color: #4d5a50;
  font-size: 0.82rem;
  font-weight: 850;
}

.room-code-box strong {
  color: #0d4d33;
  font-size: 2rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.invite-box {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(21, 115, 79, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.invite-box > span:first-child {
  color: #4d5a50;
  font-size: 0.82rem;
  font-weight: 850;
}

.invite-link-text {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7ddd5;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 9px;
  color: #123629;
  font-size: 0.78rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(21, 115, 79, 0.18);
  border-radius: 8px;
  background: rgba(16, 108, 75, 0.1);
  color: #123629;
  font-weight: 900;
}

.connection-status span:last-child {
  color: #5f665e;
  font-size: 0.86rem;
  font-weight: 850;
}

.connection-status.connected {
  border-color: rgba(13, 136, 100, 0.34);
  background: rgba(22, 160, 122, 0.14);
}

.connection-status.connecting,
.connection-status.reconnecting {
  border-color: rgba(174, 119, 34, 0.34);
  background: rgba(255, 207, 118, 0.2);
}

.connection-status.offline {
  border-color: rgba(154, 61, 42, 0.3);
  background: rgba(154, 61, 42, 0.12);
}

.room-player-list,
.rule-summary-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.room-player-list li,
.rule-summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #d7ddd5;
  border-radius: 6px;
  background: #ffffff;
  font-weight: 800;
}

.room-player-list li.current {
  border-color: rgba(21, 115, 79, 0.42);
  background: rgba(21, 115, 79, 0.08);
}

.room-player-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.room-player-list span:last-child,
.rule-summary-list span:last-child,
.muted-text {
  color: #5f665e;
  font-size: 0.86rem;
  font-weight: 800;
}

.toggle-list {
  display: grid;
  gap: 8px;
}

.toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d1d8d3;
  border-radius: 6px;
  background: #ffffff;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.toggle span {
  font-size: 0.9rem;
  font-weight: 780;
}

.sub-options {
  display: grid;
  gap: 8px;
  padding-left: 28px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 13px;
  background: #15734f;
  color: #fffdf4;
  font-weight: 900;
}

.button:hover:not(:disabled) {
  background: #0f6142;
}

.button.secondary {
  border-color: #b6c1bb;
  background: #ffffff;
  color: #17221e;
}

.button.secondary:hover:not(:disabled) {
  background: #eef4f0;
}

.button.danger {
  background: #97264a;
}

.button.danger:hover:not(:disabled) {
  background: #7a1d3a;
}

.compact-button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 0.78rem;
}

.play-screen {
  display: grid;
  gap: 12px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(820px, 1fr) minmax(300px, 400px);
  gap: 18px;
  align-items: start;
}

.felt-table {
  position: relative;
  min-height: 700px;
  overflow: hidden;
  border: 0;
  border-radius: 32px;
  background:
    url("/assets/table/table-surface.png") center / 100% 100% no-repeat;
  box-shadow:
    0 20px 30px rgba(33, 15, 4, 0.48),
    0 4px 0 rgba(255, 217, 157, 0.16);
}

.table-felt-shadow {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(255, 231, 169, 0.08);
  border-radius: 26px;
  pointer-events: none;
}

.last-action-banner {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 3;
  display: grid;
  max-width: min(330px, calc(100% - 56px));
  gap: 2px;
  border: 1px solid rgba(182, 255, 242, 0.24);
  border-radius: 10px;
  background: rgba(4, 44, 35, 0.72);
  padding: 8px 10px;
  color: #ffffff;
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

.last-action-banner span {
  color: #cde5df;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.last-action-banner strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-event-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.visual-action-toast {
  position: absolute;
  right: 28px;
  bottom: 148px;
  display: grid;
  width: min(360px, calc(100% - 56px));
  gap: 3px;
  border: 1px solid rgba(182, 255, 242, 0.32);
  border-radius: 10px;
  background: rgba(4, 44, 35, 0.82);
  padding: 9px 11px;
  color: #ffffff;
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: visual-toast var(--visual-event-duration, 1300ms) ease both;
  backdrop-filter: blur(6px);
}

.visual-action-toast span {
  color: #8beee1;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.visual-action-toast strong {
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-card-ghost {
  position: absolute;
  left: 52%;
  bottom: 104px;
  --flight-x: 8vw;
  --flight-y: -185px;
  --flight-mid-x: 5vw;
  --flight-mid-y: -150px;
  --flight-scale: 0.82;
  --flight-mid-scale: 0.9;
  --flight-rotate: 4deg;
  display: grid;
  width: 70px;
  aspect-ratio: 905 / 1368;
  place-items: center;
  border: 2px solid rgba(255, 245, 218, 0.82);
  border-radius: 7%;
  background:
    linear-gradient(145deg, rgba(255, 249, 232, 0.98), rgba(236, 213, 171, 0.98));
  color: #3a2413;
  font-size: 0.8rem;
  font-weight: 950;
  box-shadow:
    0 0 0 3px rgba(63, 231, 210, 0.24),
    0 16px 24px rgba(0, 0, 0, 0.28);
  transform-origin: 50% 85%;
}

.visual-card-ghost-real {
  width: 76px;
  aspect-ratio: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.visual-card-ghost-real .card {
  width: 100%;
  box-shadow:
    0 0 0 3px rgba(63, 231, 210, 0.24),
    0 16px 24px rgba(0, 0, 0, 0.3);
}

.visual-event-play .visual-card-ghost {
  animation: card-flight-to-pile var(--visual-event-duration, 1250ms) ease both;
}

.visual-event-draw .visual-card-ghost {
  border-color: rgba(139, 238, 225, 0.88);
  background:
    linear-gradient(145deg, rgba(255, 249, 232, 0.98), rgba(221, 238, 230, 0.98));
  animation: card-flight-to-hand var(--visual-event-duration, 820ms) ease both;
}

.visual-event-take .visual-card-ghost {
  width: 86px;
  background:
    linear-gradient(145deg, rgba(255, 249, 232, 0.98), rgba(218, 184, 128, 0.98));
  animation: pile-flight-to-player var(--visual-event-duration, 1550ms) ease both;
}

.visual-event-burn .visual-card-ghost {
  left: 67%;
  bottom: 40%;
  border-color: rgba(255, 214, 105, 0.9);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 238, 148, 0.98), transparent 36%),
    linear-gradient(145deg, #ffb342, #c84020);
  animation: pile-burn-pop var(--visual-event-duration, 1540ms) ease both;
}

.visual-event-effect .visual-card-ghost {
  border-color: rgba(255, 214, 105, 0.88);
  box-shadow:
    0 0 0 3px rgba(255, 214, 105, 0.28),
    0 0 28px rgba(255, 214, 105, 0.38);
  animation: effect-pulse var(--visual-event-duration, 1180ms) ease both;
}

.visual-event-layer .visual-card-ghost-real {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.felt-table.visual-locked .hand-card-button.playable .card,
.felt-table.visual-locked .tableau-card-button.playable .card {
  filter: saturate(0.82) brightness(0.9);
}

.felt-table.visual-locked .hand-card-button,
.felt-table.visual-locked .tableau-card-button,
.felt-table.visual-locked .card-action,
.felt-table.visual-locked .pile-action {
  pointer-events: none;
}

.discard-pile-receiving {
  box-shadow:
    0 0 0 2px rgba(63, 231, 210, 0.34),
    0 0 26px rgba(63, 231, 210, 0.28);
}

.discard-pile-taking {
  box-shadow:
    0 0 0 2px rgba(255, 214, 105, 0.4),
    0 0 26px rgba(255, 214, 105, 0.34);
}

.discard-pile-burning {
  border-color: rgba(255, 199, 83, 0.66);
  box-shadow:
    0 0 0 2px rgba(255, 199, 83, 0.38),
    0 0 34px rgba(255, 118, 45, 0.46);
}

.discard-pile-burning .card-stack {
  animation: pile-burn-glow 980ms ease both;
}

.start-reveal-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.start-reveal-overlay.start-reveal-blocking {
  pointer-events: auto;
}

.start-reveal-card {
  display: grid;
  min-width: 190px;
  justify-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 226, 147, 0.62);
  border-radius: 14px;
  background: rgba(10, 34, 28, 0.88);
  padding: 18px 20px;
  color: #ffffff;
  box-shadow:
    0 22px 36px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(255, 210, 95, 0.28);
  animation: start-reveal 2200ms ease both;
  backdrop-filter: blur(7px);
}

.start-reveal-card span {
  color: #ffd77d;
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.start-reveal-card strong {
  max-width: 180px;
  overflow: hidden;
  font-size: 1.18rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-die {
  position: relative;
  width: 76px;
  aspect-ratio: 1;
  border: 3px solid #1d1710;
  border-radius: 14px;
  background: #fff7e8;
  box-shadow:
    inset 0 2px 8px rgba(58, 32, 11, 0.16),
    0 10px 18px rgba(0, 0, 0, 0.28);
  animation: die-pop 760ms cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
}

.start-die.player-die {
  display: grid;
  place-items: center;
  gap: 4px;
  width: 88px;
  border-color: #20150d;
  background:
    linear-gradient(145deg, #fff5dc, #f0d5a3);
}

.start-die-scene {
  display: grid;
  width: 112px;
  min-height: 132px;
  justify-items: center;
  gap: 9px;
  perspective: 680px;
}

.start-die-cube {
  position: relative;
  width: 86px;
  height: 86px;
  transform-style: preserve-3d;
  animation: player-die-roll 2200ms cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.die-cube-face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  border: 2px solid rgba(36, 23, 12, 0.86);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 245, 220, 0.98), rgba(230, 199, 143, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 8px 15px rgba(0, 0, 0, 0.22);
  backface-visibility: hidden;
}

.die-cube-face.landing {
  border-color: rgba(255, 214, 105, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 0 0 3px rgba(255, 214, 105, 0.26),
    0 0 24px rgba(255, 214, 105, 0.32);
}

.die-face-front {
  transform: translateZ(43px);
}

.die-face-back {
  transform: rotateY(180deg) translateZ(43px);
}

.die-face-right {
  transform: rotateY(90deg) translateZ(43px);
}

.die-face-left {
  transform: rotateY(-90deg) translateZ(43px);
}

.die-face-top {
  transform: rotateX(90deg) translateZ(43px);
}

.die-face-bottom {
  transform: rotateX(-90deg) translateZ(43px);
}

.die-avatar-face {
  display: grid;
  width: 44px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(34, 21, 10, 0.75);
  border-radius: 999px;
  background: #14775b;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.die-cube-face .die-avatar-face {
  width: 38px;
  border-color: rgba(34, 21, 10, 0.68);
  font-size: 0.9rem;
}

.start-reveal-card .die-player-label {
  max-width: 72px;
  overflow: hidden;
  color: #2b1d10;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.start-reveal-card .die-result-label {
  max-width: 150px;
  color: #ffd77d;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.die-dot {
  position: absolute;
  width: 12px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #16120e;
  transform: translate(-50%, -50%);
}

.die-dot-top-left {
  left: 28%;
  top: 28%;
}

.die-dot-top-right {
  left: 72%;
  top: 28%;
}

.die-dot-middle-left {
  left: 28%;
  top: 50%;
}

.die-dot-middle-right {
  left: 72%;
  top: 50%;
}

.die-dot-center {
  left: 50%;
  top: 50%;
}

.die-dot-bottom-left {
  left: 28%;
  top: 72%;
}

.die-dot-bottom-right {
  left: 72%;
  top: 72%;
}

@keyframes start-reveal {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }

  15%,
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
}

@keyframes die-pop {
  0% {
    transform: rotate(-22deg) scale(0.68);
  }

  55% {
    transform: rotate(12deg) scale(1.12);
  }

  100% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes player-die-roll {
  0% {
    opacity: 0;
    transform: translateY(-18px) rotateX(-32deg) rotateY(28deg) rotateZ(-10deg) scale(0.72);
  }

  18% {
    opacity: 1;
  }

  54% {
    transform: translateY(10px) rotateX(390deg) rotateY(310deg) rotateZ(18deg) scale(1.08);
  }

  78% {
    transform: translateY(-5px) rotateX(360deg) rotateY(360deg) rotateZ(-4deg) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotateX(360deg) rotateY(360deg) rotateZ(0deg) scale(1);
  }
}

@keyframes card-soft-in {
  0% {
    opacity: 0;
    filter: saturate(0.72) brightness(1.08);
  }

  100% {
    opacity: 1;
    filter: saturate(1) brightness(1);
  }
}

@keyframes visual-toast {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  16%,
  78% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes card-flight-to-pile {
  0% {
    opacity: 0.98;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  14% {
    opacity: 1;
    transform: translate(var(--flight-mid-x), var(--flight-mid-y)) rotate(var(--flight-rotate)) scale(var(--flight-mid-scale));
  }

  74%,
  96% {
    opacity: 1;
    transform: translate(var(--flight-x), var(--flight-y)) rotate(var(--flight-rotate)) scale(var(--flight-scale));
  }

  100% {
    opacity: 1;
    transform: translate(var(--flight-x), var(--flight-y)) rotate(var(--flight-rotate)) scale(var(--flight-scale));
  }
}

@keyframes card-flight-to-hand {
  0% {
    opacity: 0;
    transform: translate(15vw, -176px) rotate(5deg) scale(0.78);
  }

  20% {
    opacity: 1;
  }

  72% {
    opacity: 1;
    transform: translate(-14vw, 76px) rotate(-6deg) scale(0.92);
  }

  100% {
    opacity: 0;
    transform: translate(-16vw, 86px) rotate(-7deg) scale(0.96);
  }
}

@keyframes pile-flight-to-player {
  0% {
    opacity: 0.96;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  18%,
  58% {
    opacity: 1;
    transform: translate(var(--flight-mid-x), var(--flight-mid-y)) rotate(var(--flight-rotate)) scale(var(--flight-mid-scale));
  }

  100% {
    opacity: 0;
    transform: translate(var(--flight-x), var(--flight-y)) rotate(var(--flight-rotate)) scale(var(--flight-scale));
  }
}

@keyframes pile-burn-pop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.74);
    filter: saturate(1) brightness(1);
  }

  22%,
  62% {
    opacity: 1;
    transform: translateY(0) scale(1.04);
    filter: saturate(1.4) brightness(1.15);
  }

  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.56);
    filter: saturate(1.6) brightness(1.35);
  }
}

@keyframes effect-pulse {
  0% {
    opacity: 0;
    transform: translate(-10vw, -70px) rotate(-8deg) scale(0.82);
  }

  24%,
  72% {
    opacity: 1;
    transform: translate(2vw, -120px) rotate(7deg) scale(0.96);
  }

  100% {
    opacity: 0;
    transform: translate(2vw, -120px) rotate(7deg) scale(0.9);
  }
}

@keyframes pile-burn-glow {
  0% {
    filter: brightness(1);
    transform: scale(1);
  }

  48% {
    filter: brightness(1.32) saturate(1.25);
    transform: scale(1.04);
  }

  100% {
    filter: brightness(1);
    transform: scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .start-reveal-card,
  .start-die,
  .start-die-cube,
  .visual-card-ghost,
  .visual-action-toast,
  .discard-pile-burning .card-stack {
    animation: none;
  }

  .card,
  .hand-card-button.playable .card,
  .hand-card-button.pending .card {
    transition: none;
  }
}

.table-seat {
  position: absolute;
  z-index: 2;
  display: grid;
  width: clamp(210px, 25vw, 292px);
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "identity tableau"
    "badges tableau";
  align-items: center;
  justify-items: start;
  column-gap: 8px;
  row-gap: 4px;
  color: #ffffff;
  pointer-events: none;
}

.table-seat .tableau-card-button {
  pointer-events: auto;
}

.seat-bottom {
  left: 50%;
  bottom: 176px;
  transform: translateX(-50%);
}

.seat-top {
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
}

.seat-left {
  left: clamp(24px, 3vw, 44px);
  top: 50%;
  transform: translateY(-50%);
}

.seat-right {
  right: clamp(24px, 3vw, 44px);
  top: 50%;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "tableau identity"
    "tableau badges";
  justify-items: end;
  transform: translateY(-50%);
}

.seat-top-left {
  left: 28%;
  top: 58px;
  transform: translateX(-50%);
}

.seat-top-right {
  right: 28%;
  top: 58px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "tableau identity"
    "tableau badges";
  justify-items: end;
  transform: translateX(50%);
}

.seat-identity {
  display: grid;
  grid-area: identity;
  justify-items: center;
  gap: 3px;
}

.avatar {
  display: grid;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 950;
}

.seat-name {
  max-width: 122px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 6px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-seat.current .avatar {
  border-color: #3fe7d2;
  box-shadow:
    0 0 0 3px rgba(63, 231, 210, 0.34),
    0 0 20px rgba(63, 231, 210, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.32);
}

.table-seat.current .seat-name {
  border-color: rgba(63, 231, 210, 0.82);
  box-shadow: 0 0 16px rgba(63, 231, 210, 0.36);
}

.table-seat.finished {
  opacity: 0.58;
}

.seat-badges {
  display: flex;
  grid-area: badges;
  max-width: 132px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
}

.tableau-cards {
  display: flex;
  grid-area: tableau;
  min-height: 78px;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.tableau-slot {
  position: relative;
  width: 58px;
  height: 82px;
}

.tableau-slot.empty {
  display: none;
}

.tableau-card-shell,
.tableau-card-button {
  position: absolute;
  width: 43px;
  height: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.tableau-card-shell .card,
.tableau-card-button .card {
  width: 43px;
}

.face-down-layer {
  top: 12px;
  left: 10px;
}

.face-up-layer {
  top: 0;
  left: 0;
}

.tableau-card-button.playable .card {
  box-shadow:
    0 0 0 3px rgba(38, 226, 210, 0.9),
    0 0 18px rgba(38, 226, 210, 0.62),
    0 7px 12px rgba(0, 0, 0, 0.28);
}

.tableau-card-button.pending .card {
  box-shadow:
    0 0 0 3px rgba(255, 190, 71, 0.9),
    0 0 18px rgba(255, 190, 71, 0.62),
    0 7px 12px rgba(0, 0, 0, 0.28);
}

.seat-badge {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  padding: 2px 6px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 850;
}

.center-piles {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 1;
  display: flex;
  gap: 16px;
  align-items: center;
  transform: translate(-25%, -50%);
}

.table-info {
  position: absolute;
  left: clamp(24px, 3vw, 42px);
  bottom: 188px;
  display: grid;
  gap: 5px;
  color: #ffffff;
  font-size: 0.94rem;
  font-weight: 850;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pile-zone {
  display: grid;
  width: 138px;
  min-height: 172px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: #fffdf4;
}

.pile-zone h3 {
  margin: 0;
  font-size: 0.88rem;
}

.pile-count {
  color: #f2ead2;
  font-size: 0.82rem;
  font-weight: 820;
}

.pile-action {
  min-height: 30px;
  border: 1px solid rgba(255, 231, 168, 0.55);
  border-radius: 999px;
  background: rgba(255, 211, 95, 0.18);
  color: #fff6d3;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 900;
}

.pile-action:hover {
  background: rgba(255, 211, 95, 0.28);
}

.card-stack {
  position: relative;
  width: 114px;
  min-height: 128px;
}

.card-stack .card + .card {
  margin-left: 0;
}

.card-stack .card {
  position: absolute;
  top: 10px;
  left: 16px;
  z-index: 4;
}

.card-stack .card:nth-last-child(2) {
  top: 7px;
  left: 10px;
  z-index: 3;
  transform: rotate(-2deg);
}

.card-stack .card:nth-last-child(3) {
  top: 12px;
  left: 6px;
  z-index: 2;
  transform: rotate(2deg);
}

.card-stack .card:nth-last-child(4) {
  top: 6px;
  left: 2px;
  z-index: 1;
  transform: rotate(-3deg);
}

.score-panel {
  display: grid;
  gap: 12px;
  min-height: 560px;
  border-radius: 8px;
  background: rgba(11, 12, 11, 0.92);
  color: #ffffff;
  padding: 14px;
  box-shadow: 0 18px 32px rgba(53, 31, 14, 0.26);
}

.score-title {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.score-title h2 {
  margin: 0;
  font-size: 1rem;
}

.score-panel .pill {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.score-grid {
  display: grid;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 76px;
  min-height: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.score-row:last-child {
  border-bottom: 0;
}

.score-row span {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 8px;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row span:last-child {
  border-right: 0;
}

.score-row.current {
  background: rgba(255, 212, 106, 0.24);
}

.action-log {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.action-log h3 {
  margin: 0;
  color: #ffffff;
  font-size: 0.9rem;
}

.action-log-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.action-log-list li {
  border-left: 3px solid rgba(139, 238, 225, 0.62);
  background: rgba(255, 255, 255, 0.08);
  padding: 7px 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.76rem;
  font-weight: 780;
  line-height: 1.25;
}

.placement-list,
.result-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.placement-list li,
.result-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 850;
}

.placement-list li.shithead-result-row,
.result-list li.shithead-result-row {
  border-color: rgba(255, 215, 125, 0.28);
  background: rgba(255, 199, 91, 0.18);
  color: #ffd77d;
}

.panel .result-list li.shithead-result-row {
  border: 1px solid rgba(117, 65, 25, 0.28);
  background: rgba(117, 65, 25, 0.12);
  color: #6d3414;
}

.shithead-summary {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 125, 0.42);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 222, 139, 0.2), transparent 5rem),
    rgba(69, 38, 18, 0.72);
  padding: 10px;
}

.shithead-mascot {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.45));
}

.shithead-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shithead-label {
  color: #ffd77d;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.shithead-copy strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 1.18rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hand-dock {
  border: 1px solid rgba(45, 36, 23, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 30px rgba(53, 31, 14, 0.22);
}

.hand-dock-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(45, 36, 23, 0.12);
}

.hand-dock-body {
  display: grid;
  padding: 12px 14px 16px;
}

.table-hand-panel {
  position: absolute;
  right: auto;
  bottom: 18px;
  left: 50%;
  z-index: 4;
  display: grid;
  width: min(560px, calc(100% - 36px));
  grid-template-columns: minmax(112px, 148px) minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(182, 255, 242, 0.24);
  border-radius: 14px;
  background: rgba(4, 44, 35, 0.72);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
}

.table-hand-header {
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 9px 11px;
  border-right: 1px solid rgba(182, 255, 242, 0.16);
  border-bottom: 0;
}

.table-hand-header .player-name span {
  color: #cde5df;
}

.table-hand-body {
  display: grid;
  min-width: 0;
  padding: 6px 8px 8px;
}

.human-card-board {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.table-hand-panel .human-card-board {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
}

.hand-card-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.table-hand-panel .hand-card-row {
  min-height: 76px;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 7px 6px 8px;
  scrollbar-color: rgba(63, 231, 210, 0.5) rgba(0, 0, 0, 0.18);
}

.hand-card-shell,
.hand-card-button {
  border: 0;
  background: transparent;
  padding: 0;
}

.table-hand-panel .hand-card-shell,
.table-hand-panel .hand-card-button {
  flex: 0 0 auto;
  margin-right: clamp(2px, 0.5vw, 6px);
}

.table-hand-panel .card {
  width: clamp(58px, 5.6vw, 66px);
}

.table-hand-panel .pip-layout {
  inset: 25px 14px;
}

.table-hand-panel .pip {
  width: 10px;
  height: 10px;
}

.table-hand-panel .pips-10 .pip {
  width: 8px;
  height: 8px;
}

.table-hand-panel .hand-play-choice {
  grid-column: 1 / -1;
  max-width: none;
  gap: 8px 10px;
  padding: 8px 10px;
}

.table-hand-panel .play-choice-text {
  min-width: 150px;
}

.table-hand-panel .play-choice-buttons {
  gap: 6px;
}

.table-hand-panel .play-count-button {
  min-height: 32px;
}

.table-hand-panel .action-list {
  min-width: 128px;
  gap: 6px;
}

.table-hand-panel .action-list h3 {
  font-size: 0.82rem;
}

.table-hand-panel .action-row {
  max-height: 96px;
}

.table-hand-panel .card-action {
  min-height: 78px;
  padding: 6px;
}

.table-hand-panel .hand-card-shell:last-child,
.table-hand-panel .hand-card-button:last-child {
  margin-right: 0;
}

.hand-card-button.playable .card {
  transform: translateY(-6px);
  box-shadow:
    0 0 0 3px rgba(38, 226, 210, 0.92),
    0 0 22px rgba(38, 226, 210, 0.68),
    0 12px 18px rgba(0, 0, 0, 0.24);
}

.hand-card-button.playable:hover .card {
  transform: translateY(-11px);
}

.hand-card-button.pending .card {
  transform: translateY(-6px);
  box-shadow:
    0 0 0 3px rgba(255, 190, 71, 0.86),
    0 0 18px rgba(255, 190, 71, 0.56),
    0 12px 18px rgba(0, 0, 0, 0.24);
}

.hand-play-choice {
  display: flex;
  max-width: 720px;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  border: 1px solid rgba(61, 83, 72, 0.2);
  border-radius: 8px;
  background: rgba(238, 244, 240, 0.92);
  padding: 10px 12px;
}

.play-choice-text {
  display: grid;
  gap: 2px;
  min-width: 190px;
}

.play-choice-text span {
  color: #455c53;
  font-size: 0.86rem;
  font-weight: 760;
}

.play-choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.play-count-button {
  min-height: 36px;
}

.player-board {
  display: grid;
  gap: 10px;
}

.player-strip {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(30, 37, 32, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.player-strip.finished {
  opacity: 0.72;
}

.player-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.player-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name span {
  color: #62706a;
  font-size: 0.82rem;
  font-weight: 760;
}

.mini-cards {
  display: flex;
  min-width: 0;
  gap: 5px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
}

.turn-section {
  display: grid;
  gap: 9px;
}

.card-area h3,
.action-list h3 {
  margin: 0;
  font-size: 0.92rem;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 82px;
  aspect-ratio: 905 / 1368;
  contain: paint;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  border-radius: 7%;
  background:
    transparent url("/assets/cards/clean/card-front.png") center / 100% 100% no-repeat;
  clip-path: inset(0 round 7%);
  color: #161616;
  place-items: center;
  user-select: none;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
  transition:
    box-shadow 180ms ease,
    filter 180ms ease,
    transform 180ms ease;
}

.card > * {
  pointer-events: none;
}

.card::after {
  position: absolute;
  inset: 6px;
  border-radius: 6%;
  box-shadow: inset 0 0 18px rgba(99, 71, 35, 0.1);
  content: "";
  pointer-events: none;
}

.card.mini {
  width: 43px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card.back {
  background:
    transparent url("/assets/cards/clean/card-back.png") center / 100% 100% no-repeat;
}

.card.empty-card {
  border: 1px dashed rgba(38, 40, 34, 0.24);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: none;
  color: #5f665e;
  font-weight: 900;
}

.card.red {
  color: #b21d1d;
}

.rank {
  position: absolute;
  z-index: 3;
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    0 1px 0 rgba(255, 221, 150, 0.85),
    0 2px 2px rgba(0, 0, 0, 0.26);
  -webkit-text-stroke: 0.36px rgba(33, 22, 12, 0.72);
}

.rank-compact {
  font-size: 0.96rem;
}

.rank-top {
  top: 7%;
  left: 8%;
}

.rank-bottom {
  right: 8%;
  bottom: 7%;
  transform: rotate(180deg);
}

.corner-suit {
  position: absolute;
  z-index: 3;
  width: 18%;
  height: auto;
  max-height: 11%;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.2));
}

.corner-suit-top {
  top: 20%;
  left: 11%;
}

.corner-suit-bottom {
  right: 11%;
  bottom: 20%;
  transform: rotate(180deg);
}

.suit-image {
  z-index: 2;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.2));
}

.face-image {
  width: 76%;
  max-height: 80%;
}

.pip-layout {
  position: absolute;
  inset: 28px 19px;
  z-index: 2;
}

.pip {
  position: absolute;
  width: 12px;
  height: 12px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.2));
}

.pip.rotated {
  transform: translate(-50%, -50%) rotate(180deg);
}

.number-card .pips-10 .pip {
  width: 10px;
  height: 10px;
}

.card.ace-card .suit-image {
  width: 72%;
  max-height: 76%;
}

.card.king-card .suit-image,
.card.queen-card .suit-image,
.card.jack-card .suit-image {
  width: 78%;
  max-height: 82%;
}

.card.ace-card .suit-name,
.card.king-card .suit-name,
.card.queen-card .suit-name,
.card.jack-card .suit-name {
  display: none;
}

.suit-name {
  display: none;
}

.card.mini .rank {
  font-size: 0.58rem;
  -webkit-text-stroke: 0.25px rgba(33, 22, 12, 0.72);
}

.card.mini .rank-compact {
  font-size: 0.52rem;
}

.card.mini .rank-top {
  top: 7%;
  left: 8%;
}

.card.mini .rank-bottom {
  right: 8%;
  bottom: 7%;
}

.card.mini .corner-suit {
  width: 18%;
  height: auto;
  max-height: 11%;
}

.card.mini .corner-suit-top {
  top: 20%;
  left: 11%;
}

.card.mini .corner-suit-bottom {
  right: 11%;
  bottom: 20%;
}

.card.mini .pip-layout {
  inset: 15px 9px;
}

.card.mini .pip {
  width: 6px;
  height: 6px;
}

.card.mini.ace-card .suit-image {
  width: 66%;
  max-height: 66%;
}

.card.mini.king-card .suit-image,
.card.mini.queen-card .suit-image,
.card.mini.jack-card .suit-image {
  width: 78%;
  max-height: 78%;
}

.card-action {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 110px;
  border: 1px solid #cdd7d1;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.card-action:hover {
  border-color: #15734f;
  box-shadow: 0 0 0 2px rgba(21, 115, 79, 0.18);
}

.card-action.selected {
  border-color: #b98216;
  background: #fff6df;
  box-shadow: 0 0 0 2px rgba(185, 130, 22, 0.22);
}

.action-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.action-row {
  max-height: 260px;
  overflow: auto;
  padding-bottom: 2px;
}

.waiting-panel {
  min-height: 160px;
  align-content: center;
  justify-items: start;
  border: 1px solid #d7ddd5;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.empty-text {
  margin: 0;
  color: #65716c;
  font-weight: 760;
}

@media (max-width: 1100px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .score-panel {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 8px;
  }

  .topbar,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .status-line {
    justify-content: flex-start;
  }

  .topbar-side {
    justify-content: flex-start;
  }

  .felt-table {
    min-height: 640px;
  }

  .seat-bottom {
    bottom: 152px;
  }

  .center-piles {
    left: 50%;
    top: 43%;
    right: auto;
    bottom: auto;
    transform: translate(-25%, -50%);
  }

  .table-info {
    left: 18px;
    bottom: 166px;
  }

  .table-hand-panel {
    right: auto;
    bottom: 12px;
    left: 50%;
    width: calc(100% - 28px);
    grid-template-columns: minmax(104px, 138px) minmax(0, 1fr);
    transform: translateX(-50%);
  }

  .last-action-banner {
    top: 18px;
    left: 18px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 6px;
  }

  .mode-grid,
  .room-card {
    grid-template-columns: 1fr;
  }

  .mode-button {
    min-height: 112px;
    padding: 14px;
  }

  .room-card-stats {
    justify-content: flex-start;
  }

  .room-player-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .room-player-meta {
    justify-content: flex-start;
  }

  .notice {
    min-height: 36px;
    margin-bottom: 8px;
    padding: 8px 10px;
  }

  .felt-table {
    min-height: 820px;
    border-radius: 24px;
  }

  .table-felt-shadow {
    inset: 14px;
    border-radius: 20px;
  }

  .last-action-banner {
    top: 22px;
    left: 22px;
    width: calc(100% - 44px);
    max-width: none;
  }

  .table-seat {
    width: 146px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "identity"
      "tableau"
      "badges";
    justify-items: center;
  }

  .seat-top {
    top: 124px;
  }

  .seat-bottom {
    bottom: 204px;
    width: min(260px, calc(100% - 54px));
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "identity tableau"
      "badges tableau";
    justify-items: start;
    column-gap: 8px;
  }

  .seat-bottom .seat-identity {
    justify-items: center;
  }

  .seat-bottom .tableau-cards {
    justify-content: flex-start;
  }

  .seat-bottom .seat-badges {
    max-width: 92px;
    justify-content: center;
  }

  .seat-top-left {
    top: 124px;
    left: 24%;
  }

  .seat-top-right {
    top: 124px;
    right: 24%;
  }

  .seat-right,
  .seat-top-right {
    grid-template-columns: 1fr;
    grid-template-areas:
      "identity"
      "tableau"
      "badges";
    justify-items: center;
  }

  .avatar {
    width: 40px;
    font-size: 0.92rem;
  }

  .seat-left {
    left: 8px;
    top: 47%;
  }

  .seat-right {
    right: 8px;
    top: 47%;
  }

  .center-piles {
    left: 50%;
    top: 48%;
    gap: 8px;
    transform: translate(-50%, -50%);
  }

  .table-info {
    display: none;
  }

  .table-hand-panel {
    right: 18px;
    bottom: 22px;
    left: 18px;
    width: auto;
    grid-template-columns: 1fr;
    transform: none;
  }

  .table-hand-header {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid rgba(182, 255, 242, 0.16);
  }

  .table-hand-panel .human-card-board {
    grid-template-columns: 1fr;
  }

  .table-hand-panel .hand-card-row {
    min-height: 66px;
    gap: 7px;
    padding: 6px 2px;
  }

  .table-hand-panel .hand-card-shell,
  .table-hand-panel .hand-card-button {
    margin-right: 0;
  }

  .table-hand-panel .card {
    width: clamp(48px, 13.5vw, 56px);
  }

  .pile-zone {
    width: min(126px, calc((100vw - 70px) / 2));
    min-height: 152px;
    padding: 8px;
  }

  .pile-zone h3 {
    font-size: 0.82rem;
  }

  .card-stack {
    width: 96px;
    min-height: 118px;
  }

  .card {
    width: 64px;
  }

  .card.mini {
    width: 34px;
  }

  .rank {
    font-size: 0.72rem;
    -webkit-text-stroke: 0.24px rgba(33, 22, 12, 0.72);
  }

  .rank-compact {
    font-size: 0.64rem;
  }

  .number-card .pip-layout {
    inset: 22px 12px;
  }

  .number-card .pip {
    width: 8px;
    height: 8px;
  }

  .number-card .pips-10 .pip {
    width: 7px;
    height: 7px;
  }

  .card.mini .pip-layout {
    inset: 15px 9px;
  }

  .card.mini .pip {
    width: 5px;
    height: 5px;
  }

  .suit-name {
    display: none;
  }

  .player-strip,
  .score-row {
    grid-template-columns: 1fr;
  }

  .tableau-cards {
    min-height: 66px;
    gap: 4px;
  }

  .tableau-slot {
    width: 46px;
    height: 66px;
  }

  .tableau-card-shell .card,
  .tableau-card-button .card {
    width: 34px;
  }

  .face-down-layer {
    top: 10px;
    left: 8px;
  }

  .app-shell.is-playing {
    display: grid;
    height: 100svh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    padding: 5px;
  }

  .app-shell.is-playing .topbar {
    min-height: 32px;
    margin-bottom: 5px;
    padding: 4px 6px;
  }

  .app-shell.is-playing .title-block {
    display: none;
  }

  .app-shell.is-playing .topbar-side {
    min-width: 0;
    justify-content: space-between;
  }

  .app-shell.is-playing .status-line {
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .app-shell.is-playing .status-line::-webkit-scrollbar {
    display: none;
  }

  .app-shell.is-playing .pill {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.7rem;
  }

  .app-shell.is-playing .topbar-leave-button {
    min-height: 26px;
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .app-shell.is-playing .notice {
    display: none;
  }

  .app-shell.is-playing .play-screen,
  .app-shell.is-playing .play-layout {
    min-height: 0;
  }

  .app-shell.is-playing .play-screen {
    display: grid;
    gap: 0;
  }

  .app-shell.is-playing .play-layout {
    display: grid;
    height: 100%;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .app-shell.is-playing .score-panel {
    display: none;
  }

  .app-shell.is-playing .felt-table {
    height: 100%;
    min-height: 0;
    border-radius: 18px;
  }

  .app-shell.is-playing .table-felt-shadow {
    inset: 10px;
    border-radius: 14px;
  }

  .app-shell.is-playing .last-action-banner {
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    padding: 5px 7px;
  }

  .app-shell.is-playing .last-action-banner span {
    font-size: 0.58rem;
  }

  .app-shell.is-playing .last-action-banner strong {
    font-size: 0.78rem;
  }

  .app-shell.is-playing .visual-action-toast {
    right: 10px;
    bottom: 104px;
    width: calc(100% - 20px);
    padding: 6px 8px;
  }

  .app-shell.is-playing .visual-action-toast strong {
    font-size: 0.8rem;
  }

  .app-shell.is-playing .table-hand-panel {
    right: 10px;
    bottom: 8px;
    left: 10px;
    width: auto;
    border-radius: 12px;
    grid-template-columns: 1fr;
    transform: none;
  }

  .app-shell.is-playing .table-hand-header {
    padding: 6px 8px;
  }

  .app-shell.is-playing .table-hand-header .pill {
    display: none;
  }

  .app-shell.is-playing .table-hand-body {
    padding: 4px 7px 7px;
  }

  .app-shell.is-playing .table-hand-panel .hand-card-row {
    min-height: 58px;
    gap: 5px;
    padding: 4px 0 5px;
  }

  .app-shell.is-playing .table-hand-panel .card {
    width: clamp(44px, 13.4vw, 52px);
  }

  /* Two-player phones have enough horizontal room for one compact seat per
     end of the table. Keep both tableaus out of the central pile lane. */
  .felt-table.players-2 .table-seat,
  .felt-table:has(> .seat-bottom + .seat-top) .table-seat {
    width: min(310px, calc(100% - 20px));
    grid-template-columns: auto auto auto;
    grid-template-areas: "identity badges tableau";
    justify-content: center;
    justify-items: start;
    column-gap: 9px;
    row-gap: 0;
  }

  .felt-table.players-2 .seat-top,
  .felt-table:has(> .seat-bottom + .seat-top) .seat-top {
    top: 84px;
  }

  .felt-table.players-2 .seat-bottom,
  .felt-table:has(> .seat-bottom + .seat-top) .seat-bottom {
    bottom: 174px;
  }

  .felt-table.players-2 .seat-identity,
  .felt-table:has(> .seat-bottom + .seat-top) .seat-identity {
    justify-items: center;
  }

  .felt-table.players-2 .tableau-cards,
  .felt-table:has(> .seat-bottom + .seat-top) .tableau-cards {
    min-height: 66px;
    justify-content: flex-start;
  }

  .felt-table.players-2 .seat-badges,
  .felt-table:has(> .seat-bottom + .seat-top) .seat-badges {
    align-self: center;
    flex-direction: column;
    max-width: 88px;
    align-items: flex-start;
    justify-content: center;
  }

  .felt-table.players-2 .center-piles,
  .felt-table:has(> .seat-bottom + .seat-top) .center-piles {
    top: 43%;
  }

  /* Android Chromium can render filtered transparent PNG layers as grey
     rectangles while scaling the cards. The card itself keeps its shadow. */
  .card .corner-suit,
  .card .suit-image,
  .card .pip {
    filter: none;
  }

  .card {
    contain: none;
    isolation: auto;
    clip-path: none;
  }

  .card::after {
    display: none;
  }

  /* Three-player phone table: opponents share the top edge, the piles keep
     the middle lane, and the human seat stays centered above the hand. */
  .felt-table.players-3 .table-seat {
    width: min(164px, calc(50% - 16px));
    grid-template-columns: auto auto;
    grid-template-areas:
      "identity badges"
      "tableau tableau";
    justify-content: center;
    justify-items: center;
    column-gap: 7px;
    row-gap: 3px;
  }

  .felt-table.players-3 .seat-left {
    top: 84px;
    left: 12px;
    transform: none;
  }

  .felt-table.players-3 .seat-right {
    top: 84px;
    right: 12px;
    transform: none;
  }

  .felt-table.players-3 .seat-badges {
    align-self: center;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .felt-table.players-3 .tableau-cards {
    min-height: 66px;
    justify-content: center;
    gap: 3px;
  }

  .felt-table.players-3 .seat-bottom {
    right: auto;
    bottom: 174px;
    left: 50%;
    width: min(310px, calc(100% - 20px));
    grid-template-columns: auto auto auto;
    grid-template-areas: "identity badges tableau";
    justify-content: center;
    justify-items: start;
    column-gap: 9px;
    transform: translateX(-50%);
  }

  .felt-table.players-3 .center-piles {
    top: 48%;
    gap: 12px;
  }

  .felt-table.players-3 .pile-zone {
    width: min(102px, calc((100vw - 72px) / 2));
    min-height: 122px;
    gap: 4px;
    padding: 6px;
  }

  .felt-table.players-3 .pile-zone h3 {
    font-size: 0.7rem;
  }

  .felt-table.players-3 .pile-count {
    font-size: 0.68rem;
  }

  .felt-table.players-3 .card-stack {
    width: 72px;
    min-height: 84px;
  }

  .felt-table.players-3 .card-stack .card {
    top: 5px;
    left: 10px;
    width: 52px;
  }

  .felt-table.players-3 .card-stack .card:nth-last-child(2) {
    top: 4px;
    left: 6px;
  }

  .felt-table.players-3 .card-stack .card:nth-last-child(3) {
    top: 6px;
    left: 3px;
  }

  .felt-table.players-3 .card-stack .card:nth-last-child(4) {
    top: 4px;
    left: 1px;
  }

  .felt-table.players-4 .table-seat {
    width: 122px;
    row-gap: 2px;
  }

  .felt-table.players-4 .avatar {
    width: 34px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 0.78rem;
  }

  .felt-table.players-4 .seat-name {
    max-width: 82px;
    padding: 2px 5px;
    font-size: 0.68rem;
  }

  .felt-table.players-4 .seat-badge {
    padding: 1px 5px;
    font-size: 0.62rem;
  }

  .felt-table.players-4 .tableau-cards {
    min-height: 54px;
    gap: 3px;
  }

  .felt-table.players-4 .tableau-slot {
    width: 38px;
    height: 54px;
  }

  .felt-table.players-4 .tableau-card-shell,
  .felt-table.players-4 .tableau-card-button {
    width: 30px;
  }

  .felt-table.players-4 .tableau-card-shell .card,
  .felt-table.players-4 .tableau-card-button .card {
    width: 30px;
  }

  .felt-table.players-4 .face-down-layer {
    top: 8px;
    left: 6px;
  }

  .felt-table.players-4 .seat-top {
    top: 58px;
    width: min(248px, calc(100% - 34px));
    grid-template-columns: auto auto auto;
    grid-template-areas: "identity badges tableau";
    justify-content: center;
    justify-items: center;
    column-gap: 6px;
  }

  .felt-table.players-4 .seat-top .seat-badges {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
  }

  .felt-table.players-4 .seat-left,
  .felt-table.players-4 .seat-right {
    top: 38%;
    width: 210px;
    grid-template-columns: auto auto auto;
    grid-template-areas: "identity badges tableau";
    align-items: center;
    justify-content: center;
    justify-items: center;
    column-gap: 6px;
    transform-origin: center;
  }

  .felt-table.players-4 .seat-left {
    left: -60px;
    transform: translateY(-50%) rotate(-90deg);
  }

  .felt-table.players-4 .seat-right {
    right: -60px;
    transform: translateY(-50%) rotate(90deg);
  }

  .felt-table.players-4 .center-piles {
    top: 48%;
    gap: 6px;
    transform: translate(-50%, -50%);
  }

  .felt-table.players-4 .pile-zone {
    width: min(98px, calc((100vw - 54px) / 2));
    min-height: 112px;
    gap: 5px;
    padding: 6px;
  }

  .felt-table.players-4 .pile-zone h3 {
    font-size: 0.72rem;
  }

  .felt-table.players-4 .pile-count {
    font-size: 0.7rem;
  }

  .felt-table.players-4 .pile-action {
    min-height: 24px;
    padding: 3px 9px;
    font-size: 0.66rem;
  }

  .felt-table.players-4 .card-stack {
    width: 74px;
    min-height: 84px;
  }

  .felt-table.players-4 .card-stack .card {
    top: 6px;
    left: 13px;
    width: 48px;
  }

  .felt-table.players-4 .card-stack .card:nth-last-child(2) {
    top: 4px;
    left: 8px;
  }

  .felt-table.players-4 .card-stack .card:nth-last-child(3) {
    top: 8px;
    left: 4px;
  }

  .felt-table.players-4 .card-stack .card:nth-last-child(4) {
    top: 4px;
    left: 1px;
  }

  .felt-table.players-4 .seat-bottom {
    bottom: 178px;
    width: min(248px, calc(100% - 34px));
    column-gap: 6px;
  }

  .felt-table.players-4 .seat-bottom .seat-badges {
    max-width: 76px;
  }

  .felt-table.players-4 .seat-left .seat-name,
  .felt-table.players-4 .seat-right .seat-name {
    max-width: 76px;
  }

  .felt-table.players-4 .seat-left .tableau-cards,
  .felt-table.players-4 .seat-right .tableau-cards {
    width: auto;
    min-height: 48px;
    gap: 0;
    overflow: visible;
  }

  .felt-table.players-4 .seat-left .seat-badges,
  .felt-table.players-4 .seat-right .seat-badges {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
  }

  .felt-table.players-4 .seat-left .tableau-slot,
  .felt-table.players-4 .seat-right .tableau-slot {
    width: 26px;
    height: 48px;
  }

  .felt-table.players-4 .seat-left .tableau-card-shell,
  .felt-table.players-4 .seat-left .tableau-card-button,
  .felt-table.players-4 .seat-right .tableau-card-shell,
  .felt-table.players-4 .seat-right .tableau-card-button {
    width: 28px;
  }

  .felt-table.players-4 .seat-left .tableau-card-shell .card,
  .felt-table.players-4 .seat-left .tableau-card-button .card,
  .felt-table.players-4 .seat-right .tableau-card-shell .card,
  .felt-table.players-4 .seat-right .tableau-card-button .card {
    width: 28px;
  }

  .felt-table.players-4 .seat-left .face-down-layer,
  .felt-table.players-4 .seat-right .face-down-layer {
    top: 7px;
    left: 5px;
  }

  .score-row span {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .score-row span:last-child {
    border-bottom: 0;
  }
}
