:root {
  --card-w: 74px;
  --card-h: 106px;
  --dock-h: 218px;
  --gold: #f6c453;
  --gold-light: #ffe9a3;
  --red: #e84a3c;
  --jade: #18b487;
  --ink: #06251d;
  --felt: #0d7a56;
  --felt-dark: #064536;
  --panel: rgba(6, 42, 33, 0.88);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #04140f;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: #f7f2df;
  user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

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

.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(34, 168, 124, 0.18), transparent 34%),
    radial-gradient(circle at 85% 20%, rgba(246, 196, 83, 0.1), transparent 30%),
    linear-gradient(180deg, #06281f 0%, #03150f 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.45;
}

.bg-glow-a {
  width: 46vw;
  height: 46vw;
  left: -14vw;
  top: 8vh;
  background: rgba(26, 188, 136, 0.28);
}

.bg-glow-b {
  width: 40vw;
  height: 40vw;
  right: -12vw;
  bottom: -8vh;
  background: rgba(232, 74, 60, 0.16);
}

.topbar {
  position: relative;
  z-index: 30;
  height: calc(58px + env(safe-area-inset-top, 0px));
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: linear-gradient(180deg, rgba(8, 52, 41, 0.98), rgba(5, 35, 28, 0.92));
  border-bottom: 1px solid rgba(246, 196, 83, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-badge {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  animation: badgeFloat 3.6s ease-in-out infinite;
}

.brand-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-family: KaiTi, STKaiti, "华文行楷", serif;
  font-size: clamp(18px, 3vw, 25px);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff6d5, #f6c453 55%, #d98b1f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(120, 60, 10, 0.25);
  white-space: nowrap;
}

.brand-sub {
  font-size: 10px;
  color: rgba(247, 242, 223, 0.62);
  letter-spacing: 2px;
  margin-top: 2px;
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 700;
  color: #ffe9b0;
  white-space: nowrap;
}

.stat-chip strong {
  color: #ffd76a;
  font-size: 16px;
}

.coin {
  width: 17px;
  height: 17px;
  border-radius: 58% 42% 52% 48% / 55% 58% 42% 45%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.95) 0 12%, rgba(255, 255, 255, 0) 13%),
    radial-gradient(circle at 35% 30%, #fff3ae 0%, #f8c94b 46%, #d28714 100%);
  box-shadow:
    inset -2px -2px 3px rgba(125, 65, 5, 0.35),
    inset 2px 2px 4px rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.28);
  transform: rotate(-16deg);
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.coin::before {
  content: "";
  position: absolute;
  left: 8px;
  top: -3px;
  width: 6px;
  height: 5px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #b5f28a, #3ca354);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transform: rotate(-24deg);
  z-index: 2;
}

.coin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 60%;
  width: 8px;
  height: 4px;
  border-bottom: 1.6px solid rgba(126, 68, 8, 0.6);
  border-radius: 0 0 999px 999px;
  transform: translate(-50%, -50%) rotate(16deg);
}

.coin.tiny {
  width: 13px;
  height: 13px;
}

.coin.tiny::before {
  left: 6px;
  top: -2px;
  width: 5px;
  height: 4px;
}

.coin.tiny::after {
  width: 6px;
  height: 3px;
  border-bottom-width: 1.2px;
}

.multiplier-chip strong {
  font-size: 17px;
}

.mul-label {
  font-size: 11px;
  color: rgba(247, 242, 223, 0.7);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.text-btn {
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ffe9b0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn {
  width: 36px;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.text-btn {
  padding: 0 13px;
  font-weight: 700;
}

.icon-btn:active,
.text-btn:active {
  transform: scale(0.94);
}

body:not(.audio-unlocked) #soundBtn {
  animation: soundNudge 1.5s ease-in-out infinite;
}

@keyframes soundNudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 106, 0.0); }
  50% { box-shadow: 0 0 0 5px rgba(255, 215, 106, 0.18), 0 0 18px rgba(255, 215, 106, 0.4); }
}

.table {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(29, 178, 129, 0.5), transparent 58%),
    radial-gradient(ellipse at 50% 50%, var(--felt) 0%, var(--felt-dark) 72%, #033326 100%);
  border-top: 1px solid rgba(255, 226, 150, 0.12);
}

.desktop-scene,
.desktop-wood {
  display: none;
}

.felt-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.38;
  background-image:
    radial-gradient(circle at 50% 100%, transparent 0 9px, rgba(255, 244, 203, 0.05) 9px 10px, transparent 10px 19px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 9px),
    radial-gradient(circle, rgba(255, 244, 203, 0.05) 0 1px, transparent 1.4px);
  background-size: 38px 19px, auto, auto, 18px 18px;
  pointer-events: none;
}

.felt-ring {
  position: absolute;
  left: 50%;
  top: 48%;
  border: 1.5px dashed rgba(255, 226, 150, 0.16);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ring-a {
  width: min(78vw, 980px);
  height: min(52vh, 520px);
}

.ring-b {
  width: min(58vw, 720px);
  height: min(38vh, 380px);
  border-style: solid;
  opacity: 0.5;
}

.table-emblem {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(44vw, 330px);
  transform: translate(-50%, -50%);
  opacity: 0.95;
  pointer-events: none;
}

.table-emblem svg {
  width: 100%;
  display: block;
}

.table.shake-bomb {
  animation: shakeBomb 0.55s ease;
}

.table.shake-rocket {
  animation: shakeRocket 0.7s ease;
}

.bottom-cards {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.plate-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: rgba(255, 235, 177, 0.78);
  background: rgba(3, 36, 27, 0.55);
  border: 1px solid rgba(246, 196, 83, 0.28);
  border-radius: 999px;
  padding: 2px 12px;
}

.mini-card-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.mini-card-row .card {
  width: 46px;
  height: 66px;
  border-radius: 7px;
  margin-left: -8px;
}

.mini-card-row .card:first-child {
  margin-left: 0;
}

.mini-card-row .card-corner {
  font-size: 11px;
}

.mini-card-row .corner-rank {
  font-size: 12px;
}

.mini-card-row .pip-center {
  font-size: 22px;
}

.mini-card-row .face-letter {
  font-size: 20px;
}

.mini-card-row .face-suit {
  font-size: 10px;
}

.mini-card-row .joker-center span {
  font-size: 16px;
}

.mini-card-row .back-emblem {
  font-size: 15px;
  width: 24px;
  height: 24px;
}

.seat {
  position: absolute;
  z-index: 14;
}

.seat-side {
  top: 17%;
  width: 220px;
}

.seat-left {
  left: 16px;
}

.seat-right {
  right: 16px;
}

.seat-right .avatar-wrap {
  flex-direction: row-reverse;
  text-align: right;
}

.seat-bottom {
  left: 16px;
  bottom: calc(var(--dock-h) + 4px);
  z-index: 16;
}

.avatar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.avatar {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.avatar svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  overflow: visible;
}

.seat-bottom .avatar {
  width: 64px;
  height: 64px;
}

.avatar .hat-farmer,
.avatar .hat-landlord {
  display: none;
}

.avatar-wrap.is-farmer .hat-farmer,
.avatar-wrap.is-landlord .hat-landlord {
  display: block;
}

.seat.active .avatar {
  transform: translateY(-3px) scale(1.05);
  filter:
    drop-shadow(0 0 12px rgba(255, 222, 133, 0.85))
    drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
}

.seat.active .avatar::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(255, 224, 138, 0.9);
  animation: activePulse 1.3s ease-in-out infinite;
}

.role-badge {
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: linear-gradient(180deg, #2fbf8d, #148a62);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
}

.role-badge.landlord {
  background: linear-gradient(180deg, #ffb84d, #e84a3c);
}

.seat-copy {
  min-width: 0;
}

.seat-name {
  font-weight: 800;
  font-size: 15px;
  color: #fff7de;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.seat-beans {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 237, 184, 0.86);
}

.seat-right .seat-beans {
  justify-content: flex-end;
}

.count-badge {
  position: absolute;
  top: -6px;
  left: 58px;
  font-size: 12px;
  font-weight: 800;
  color: #fff4cf;
  background: rgba(3, 32, 25, 0.82);
  border: 1px solid rgba(246, 196, 83, 0.4);
  border-radius: 999px;
  padding: 3px 9px;
  z-index: 3;
}

.seat-right .count-badge {
  left: auto;
  right: 58px;
}

.mini-hand {
  position: absolute;
  top: 70px;
  left: 48px;
  display: flex;
  align-items: flex-start;
  height: 62px;
  pointer-events: none;
}

.seat-right .mini-hand {
  left: auto;
  right: 48px;
  flex-direction: row-reverse;
}

.mini-hand .card {
  --lift: 0px;
  width: 34px;
  height: 48px;
  margin-left: -22px;
  transform: rotate(var(--rot, 0deg)) translateY(var(--arc, 0px));
  transform-origin: 50% 120%;
}

.mini-hand .card:first-child {
  margin-left: 0;
}

.seat-right .mini-hand .card {
  margin-left: 0;
  margin-right: -22px;
}

.speech-bubble {
  position: absolute;
  top: -14px;
  left: 78px;
  z-index: 20;
  background: linear-gradient(180deg, #fffdf5, #f4ecd8);
  color: #2b2118;
  font-weight: 800;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  transform-origin: 10% 100%;
  animation: bubblePop 0.24s ease;
  white-space: nowrap;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -7px;
  border: 7px solid transparent;
  border-top-color: #f4ecd8;
  border-right: 0;
  transform: rotate(-12deg);
}

.seat-right .speech-bubble {
  left: auto;
  right: 78px;
  border-radius: 14px;
  border-bottom-right-radius: 4px;
}

.seat-bottom .speech-bubble {
  top: -18px;
  left: 70px;
}

.play-area {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  width: min(640px, 74%);
  min-height: 150px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 246, 216, 0.92);
  background: rgba(3, 35, 27, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 7px 16px;
  backdrop-filter: blur(4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.turn-pill[data-state="you"] {
  color: #1e1607;
  background: linear-gradient(180deg, #ffe9a3, #f6c453);
  border-color: rgba(255, 255, 255, 0.55);
}

.turn-pill[data-state="landlord"] {
  background: linear-gradient(180deg, #ff9d62, #e84a3c);
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7ce0b4;
  box-shadow: 0 0 0 0 rgba(124, 224, 180, 0.7);
  animation: dotPulse 1.4s ease-out infinite;
}

.turn-pill[data-state="you"] .turn-dot {
  background: #0b6f50;
  box-shadow: 0 0 0 0 rgba(11, 111, 80, 0.5);
}

.last-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  animation: playAreaIn 0.28s ease;
}

.last-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.last-player {
  color: rgba(255, 243, 205, 0.9);
  font-weight: 700;
}

.combo-name {
  color: #ffe085;
  font-weight: 900;
  background: rgba(3, 35, 27, 0.55);
  border: 1px solid rgba(246, 196, 83, 0.32);
  border-radius: 999px;
  padding: 2px 10px;
}

.last-cards .card {
  margin-left: calc(-1 * var(--last-overlap, 8px));
  animation: cardDrop 0.26s ease backwards;
  animation-delay: calc(var(--i, 0) * 0.035s);
}

.last-cards .card:first-child {
  margin-left: 0;
}

.last-cards[data-density="small"] .card {
  width: 38px;
  height: 56px;
  border-radius: 6px;
}

.last-cards[data-density="small"] .card-corner {
  top: 4px;
  left: 4px;
  font-size: 9px;
}

.last-cards[data-density="small"] .corner-rank {
  font-size: 10px;
}

.last-cards[data-density="small"] .corner-suit {
  font-size: 8px;
  margin-top: 1px;
}

.last-cards[data-density="small"] .corner-flip {
  top: auto;
  left: auto;
  right: 4px;
  bottom: 4px;
}

.last-cards[data-density="small"] .pip-center {
  font-size: 18px;
}

.last-cards[data-density="small"] .face-letter {
  font-size: 16px;
}

.last-cards[data-density="small"] .face-letter.rank-2 {
  font-size: 15px;
}

.last-cards[data-density="small"] .face-suit {
  font-size: 8px;
}

.last-cards[data-density="small"] .joker-center span {
  font-size: 13px;
}

.last-cards[data-density="small"] .back-emblem {
  width: 20px;
  height: 20px;
  font-size: 12px;
}

.last-cards[data-density="tiny"] .card {
  width: 34px;
  height: 50px;
  border-radius: 5px;
}

.last-cards[data-density="tiny"] .card-corner {
  top: 3px;
  left: 3px;
  font-size: 8px;
}

.last-cards[data-density="tiny"] .corner-rank {
  font-size: 9px;
}

.last-cards[data-density="tiny"] .corner-suit {
  font-size: 7px;
  margin-top: 1px;
}

.last-cards[data-density="tiny"] .corner-flip {
  top: auto;
  left: auto;
  right: 3px;
  bottom: 3px;
}

.last-cards[data-density="tiny"] .pip-center {
  font-size: 15px;
}

.last-cards[data-density="tiny"] .face-letter {
  font-size: 14px;
}

.last-cards[data-density="tiny"] .face-letter.rank-2 {
  font-size: 13px;
}

.last-cards[data-density="tiny"] .face-suit {
  font-size: 7px;
}

.last-cards[data-density="tiny"] .joker-center span {
  font-size: 11px;
}

.last-cards[data-density="tiny"] .back-emblem {
  width: 17px;
  height: 17px;
  font-size: 10px;
}

.combo-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: KaiTi, STKaiti, serif;
  font-size: clamp(34px, 7vw, 58px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff1b8;
  text-shadow:
    0 0 16px rgba(255, 176, 59, 0.95),
    0 4px 0 #b83b21,
    0 10px 24px rgba(0, 0, 0, 0.45);
  z-index: 30;
  white-space: nowrap;
}

.combo-burst.show {
  animation: burstPop 1.05s ease forwards;
}

.pass-stamp {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: 31;
  transform: translate(-50%, -50%) rotate(-8deg) scale(0.7);
  font-family: KaiTi, STKaiti, serif;
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 900;
  letter-spacing: 6px;
  color: rgba(255, 226, 166, 0.96);
  text-shadow:
    0 0 14px rgba(232, 74, 60, 0.65),
    0 3px 0 rgba(126, 31, 20, 0.9),
    0 8px 18px rgba(0, 0, 0, 0.4);
  border: 3px double rgba(255, 196, 107, 0.72);
  border-radius: 14px;
  padding: 6px 18px 8px;
  background: radial-gradient(ellipse at center, rgba(120, 22, 16, 0.55), rgba(80, 12, 8, 0.15));
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.pass-stamp.show {
  animation: passStampPop 0.95s ease forwards;
}

.hand-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--dock-h);
  z-index: 20;
  background:
    linear-gradient(180deg, transparent 0%, rgba(3, 24, 18, 0.28) 34%, rgba(2, 18, 14, 0.78) 100%);
  pointer-events: none;
}

.controls {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 4;
  pointer-events: auto;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(3, 35, 27, 0.78);
  border: 1px solid rgba(246, 196, 83, 0.38);
  color: #ffe9a3;
  font-weight: 900;
  font-size: 14px;
}

.game-btn {
  position: relative;
  min-width: 74px;
  height: 42px;
  padding: 0 16px;
  white-space: nowrap;
  border: none;
  border-radius: 14px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  color: #fff9e8;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 0 rgba(0, 0, 0, 0.22),
    0 10px 18px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.game-btn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.game-btn.red {
  background: linear-gradient(180deg, #ff7a63, #e0402f 60%, #b92b22);
}

.game-btn.gold {
  background: linear-gradient(180deg, #ffe08a, #f4b93f 58%, #d88615);
  color: #4a2a06;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.game-btn.teal {
  background: linear-gradient(180deg, #43d6a6, #16a97c 58%, #0b7f5b);
}

.game-btn.ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-btn.big {
  min-width: 132px;
  height: 48px;
  font-size: 17px;
}

.game-btn.wide {
  width: 100%;
}

.game-btn:active {
  transform: translateY(3px) scale(0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 3px 0 rgba(0, 0, 0, 0.22),
    0 6px 12px rgba(0, 0, 0, 0.22);
}

.game-btn:disabled {
  opacity: 1;
  color: rgba(232, 242, 235, 0.42);
  background: linear-gradient(180deg, rgba(49, 66, 58, 0.92), rgba(22, 36, 31, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  filter: saturate(0.2);
  cursor: not-allowed;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 0 rgba(0, 0, 0, 0.22);
}

.game-btn:disabled::before {
  display: none;
}

.game-btn:disabled::after {
  border-color: rgba(255, 255, 255, 0.05);
}

.game-btn.recommended {
  animation: recommendGlow 1.2s ease-in-out infinite;
}

.game-btn.pulse {
  animation: passPulse 0.75s ease 2;
}

.selection-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 13px;
  font-weight: 800;
  color: #ffe9a3;
  background: rgba(3, 35, 27, 0.72);
  border: 1px solid rgba(246, 196, 83, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
}

.selection-label[data-valid="0"] {
  color: #ffb1a4;
  border-color: rgba(232, 74, 60, 0.5);
}

.hand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(6px + var(--safe-bottom));
  height: calc(var(--card-h) + 34px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 24px;
  pointer-events: auto;
  touch-action: none;
}

.hand.dragging .card {
  transition: none;
  cursor: grabbing;
}

.card {
  --lift: 0px;
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #fffef9 0%, #f7f1e2 62%, #e9e1cd 100%);
  border: 1px solid rgba(184, 172, 146, 0.85);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 16px rgba(0, 0, 0, 0.28);
  color: #1c1c1c;
  overflow: hidden;
  transform-origin: 50% 100%;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.5), transparent 36%, transparent 70%, rgba(255, 255, 255, 0.16));
  pointer-events: none;
}

.card.red {
  color: #d5322c;
}

.card.black {
  color: #1f2430;
}

.hand .card {
  margin-left: calc(-1 * var(--hand-overlap, 4px));
  z-index: calc(var(--i, 0) + 1);
  cursor: pointer;
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--arc, 0px) + var(--lift)));
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.hand .card:first-child {
  margin-left: 0;
}

.hand .card:hover {
  --lift: -10px;
}

.hand .card.selected {
  --lift: -26px;
  z-index: 80 !important;
  box-shadow:
    0 0 0 2px rgba(255, 215, 106, 0.95),
    0 0 18px rgba(255, 215, 106, 0.55),
    0 14px 22px rgba(0, 0, 0, 0.34);
}

.card-corner {
  position: absolute;
  top: 5px;
  left: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  z-index: 2;
}

.corner-rank {
  font-size: clamp(20px, 3.4vh, 25px);
  font-weight: 900;
}

.corner-suit {
  font-size: clamp(14px, 2.2vh, 18px);
  margin-top: 1px;
}

.corner-flip {
  top: auto;
  left: auto;
  right: 6px;
  bottom: 5px;
  transform: rotate(180deg);
}

.pip-center {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  font-size: clamp(34px, 6vh, 50px);
  line-height: 1;
  opacity: 0.9;
}

.face-center {
  position: absolute;
  left: 50%;
  top: 53%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.face-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 6vh, 48px);
  font-weight: 900;
  line-height: 0.9;
}

.face-letter.rank-2 {
  font-size: clamp(32px, 5.6vh, 44px);
}

.face-suit {
  font-size: clamp(14px, 2.2vh, 19px);
}

.joker {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), transparent 45%),
    linear-gradient(180deg, #fffaf0, #f2e4c8);
}

.joker-small {
  color: #2e3440;
}

.joker-big {
  color: #d5322c;
}

.corner-flip {
  display: none;
}

.suit-big {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 5.6vh, 44px);
  line-height: 0.82;
  opacity: 0.94;
}

.joker-vertical {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 7px;
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(12px, 2.2vh, 16px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 1px;
  text-align: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.joker-big .joker-vertical {
  color: #c92c33;
}

.joker-small .joker-vertical {
  color: #27303d;
}

.joker-silhouette {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: block;
  width: 44%;
  height: 64%;
  color: currentColor;
  opacity: 0.13;
}

.card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, #fffefa, #f7f3ea);
}

.card.joker {
  background: linear-gradient(180deg, #fffefa, #f3ead7);
}

.card.back {
  background:
    radial-gradient(circle at center, rgba(255, 226, 150, 0.22) 0 14%, transparent 15%),
    linear-gradient(135deg, #c73b34, #8f1f24 55%, #6d161d);
  border-color: rgba(255, 224, 160, 0.65);
  display: grid;
  place-items: center;
}

.back-pattern {
  position: absolute;
  inset: 5px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 224, 160, 0.65);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 224, 160, 0.2) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 224, 160, 0.2) 0 1px, transparent 1px 9px),
    radial-gradient(circle at center, rgba(255, 224, 160, 0.18) 0 30%, transparent 31%);
}

.back-emblem {
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: KaiTi, STKaiti, serif;
  font-size: 20px;
  font-weight: 900;
  color: #ffe9a3;
  background: rgba(90, 16, 20, 0.72);
  border: 1.5px solid rgba(255, 224, 160, 0.75);
  box-shadow: 0 0 0 4px rgba(255, 224, 160, 0.14);
}

.card.flip-reveal {
  animation: flipReveal 0.55s ease backwards;
  animation-delay: calc(var(--i, 0) * 0.11s);
}

.hand.dealing .card {
  animation: dealIn 0.42s ease backwards;
  animation-delay: calc(var(--i, 0) * 0.035s);
}

.fly-layer {
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
  overflow: hidden;
}

.fly-card {
  position: fixed;
  margin: 0 !important;
  transform-origin: top left;
  will-change: transform, opacity;
}

.toast {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -10px);
  z-index: 60;
  max-width: min(88vw, 460px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(3, 30, 23, 0.9);
  border: 1px solid rgba(255, 231, 164, 0.42);
  color: #ffe9a3;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind="error"] {
  color: #ffd0c7;
  border-color: rgba(255, 122, 99, 0.55);
}

.toast[data-kind="warn"] {
  color: #fff0c8;
  border-color: rgba(246, 196, 83, 0.55);
}

.table-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 245, 200, 0.75), transparent 55%);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
}

.table-flash.fire {
  animation: flashFire 0.48s ease-out;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 16, 12, 0.74);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.overlay.show {
  opacity: 1;
}

.result-card {
  position: relative;
  width: min(430px, 94vw);
  padding: 34px 26px 26px;
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.18), transparent 45%),
    linear-gradient(180deg, #0b4b3b, #062a21);
  border: 1.5px solid rgba(246, 196, 83, 0.55);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.overlay.show .result-card {
  transform: translateY(0) scale(1);
}

.result-ribbon {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 130px;
  padding: 8px 26px;
  border-radius: 999px;
  font-family: KaiTi, STKaiti, serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #4a2a06;
  background: linear-gradient(180deg, #ffe9a3, #f6c453 60%, #dd8f1c);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.32);
}

.result-ribbon[data-win="0"] {
  color: #fff5e6;
  background: linear-gradient(180deg, #8d9aa6, #5d6a76 60%, #46515c);
}

.result-icon {
  width: 92px;
  height: 92px;
  margin: 4px auto 8px;
  animation: trophyBounce 1.8s ease-in-out infinite;
}

.result-icon svg,
.result-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.result-icon[data-win="0"] {
  animation: none;
}

.result-title {
  font-size: 30px;
  font-weight: 900;
  color: #fff4d3;
  letter-spacing: 2px;
}

.result-sub {
  margin-top: 8px;
  color: rgba(255, 243, 205, 0.72);
  font-size: 14px;
}

.result-delta {
  margin-top: 14px;
  font-size: 30px;
  font-weight: 900;
  color: #ffd76a;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.result-delta[data-win="0"] {
  color: #ff9d8f;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: 0.95;
  animation-name: confettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.modal {
  position: relative;
  width: min(680px, 94vw);
  max-height: min(86vh, 720px);
  overflow: auto;
  border-radius: 24px;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.14), transparent 42%),
    linear-gradient(180deg, #0a4737, #062a21);
  border: 1.5px solid rgba(246, 196, 83, 0.5);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.24s ease;
}

.overlay.show .modal {
  transform: translateY(0) scale(1);
}

.help-card h2 {
  margin: 0 0 16px;
  padding: 0 38px;
  text-align: center;
  font-family: KaiTi, STKaiti, serif;
  font-size: clamp(22px, 5vw, 27px);
  color: #ffe9a3;
  letter-spacing: 3px;
}

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

.help-grid section {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
}

.help-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #ffd76a;
}

.help-grid p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: rgba(247, 242, 223, 0.82);
}

.help-card .wide {
  margin-top: 18px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@keyframes badgeFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

@keyframes activePulse {
  0% { transform: scale(0.96); opacity: 1; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 224, 180, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(124, 224, 180, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 224, 180, 0); }
}

@keyframes bubblePop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes playAreaIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardDrop {
  from { opacity: 0; transform: translateY(-14px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes burstPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.14) rotate(2deg); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -66%) scale(0.96); }
}

@keyframes passStampPop {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-18deg) scale(0.55); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1.1); }
  65% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) rotate(-8deg) scale(1.04); }
}

@keyframes flashFire {
  0% { opacity: 0; }
  18% { opacity: 0.9; }
  100% { opacity: 0; }
}

@keyframes shakeBomb {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-9px, 4px); }
  30% { transform: translate(8px, -5px); }
  45% { transform: translate(-7px, -3px); }
  60% { transform: translate(6px, 4px); }
  75% { transform: translate(-4px, 2px); }
}

@keyframes shakeRocket {
  0%, 100% { transform: translate(0, 0) scale(1); filter: brightness(1); }
  20% { transform: translate(-10px, 6px) scale(1.01); filter: brightness(1.35); }
  40% { transform: translate(10px, -6px) scale(1.01); filter: brightness(1.5); }
  60% { transform: translate(-8px, -4px) scale(1.005); filter: brightness(1.25); }
  80% { transform: translate(6px, 5px); filter: brightness(1.1); }
}

@keyframes recommendGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 0 rgba(0,0,0,.22), 0 0 0 rgba(255, 215, 106, 0); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 0 rgba(0,0,0,.22), 0 0 22px rgba(255, 215, 106, 0.85); }
}

@keyframes passPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); filter: brightness(1.3); }
}

@keyframes dealIn {
  from {
    opacity: 0;
    transform: translate3d(-42vw, -58vh, 0) rotate(calc(var(--rot, 0deg) - 16deg)) scale(0.6);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) translateY(calc(var(--arc, 0px) + var(--lift)));
  }
}

@keyframes flipReveal {
  0% { transform: rotateY(90deg) scale(0.9); opacity: 0; }
  55% { transform: rotateY(0deg) scale(1.08); opacity: 1; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.2; }
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.topbar {
  background:
    linear-gradient(180deg, rgba(10, 60, 47, 0.99), rgba(5, 35, 28, 0.94)),
    radial-gradient(circle at 18% 0%, rgba(255, 220, 130, 0.12), transparent 42%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 231, 160, 0.1);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 130, 0.85), transparent);
  box-shadow: 0 0 12px rgba(255, 215, 106, 0.55);
  animation: topLine 5s ease-in-out infinite;
}

.brand-title {
  background-size: 220% 100%;
  animation: titleSheen 7s ease-in-out infinite;
}

.stat-chip {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 5px 14px rgba(0, 0, 0, 0.16);
}

.icon-btn,
.text-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 12px rgba(0, 0, 0, 0.16);
}

.icon-btn:hover,
.text-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 226, 150, 0.34);
}

.table {
  background:
    radial-gradient(ellipse at 12% 6%, rgba(232, 74, 60, 0.1), transparent 28%),
    radial-gradient(ellipse at 88% 8%, rgba(255, 215, 106, 0.1), transparent 30%),
    radial-gradient(ellipse at 50% 18%, rgba(255, 236, 170, 0.11), transparent 36%),
    radial-gradient(ellipse at 50% 46%, rgba(29, 178, 129, 0.55), transparent 58%),
    radial-gradient(ellipse at 50% 118%, rgba(0, 0, 0, 0.5), transparent 62%),
    radial-gradient(ellipse at 50% 50%, var(--felt) 0%, var(--felt-dark) 72%, #033326 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 226, 150, 0.12),
    inset 0 0 0 10px rgba(3, 26, 20, 0.66),
    inset 0 0 120px rgba(0, 0, 0, 0.48);
}

.table-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, transparent 34%, rgba(1, 16, 12, 0.28) 76%, rgba(0, 8, 6, 0.55) 100%);
}

.stage-light {
  position: absolute;
  left: 50%;
  top: 34%;
  width: min(960px, 110vw);
  height: min(560px, 66vh);
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(255, 244, 203, 0.16), rgba(255, 221, 128, 0.07) 36%, transparent 68%);
  filter: blur(10px);
  animation: stageBreathe 6.5s ease-in-out infinite;
}

.ambient-sweep {
  position: absolute;
  inset: -35%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: screen;
  background: linear-gradient(112deg, transparent 38%, rgba(255, 244, 203, 0.035) 45%, rgba(255, 244, 203, 0.11) 50%, rgba(255, 244, 203, 0.035) 55%, transparent 62%);
  animation: lightSweep 15s linear infinite;
}

.felt-ring {
  z-index: 1;
  box-shadow: 0 0 30px rgba(255, 226, 150, 0.04);
}

.ring-b {
  box-shadow: inset 0 0 60px rgba(255, 226, 150, 0.05), 0 0 40px rgba(255, 226, 150, 0.03);
}

.table-emblem {
  z-index: 1;
  filter: drop-shadow(0 0 18px rgba(255, 220, 130, 0.12));
  animation: emblemFloat 8s ease-in-out infinite;
}

.table-rim {
  position: absolute;
  inset: 8px;
  z-index: 3;
  pointer-events: none;
  border-radius: 30px;
  border: 1px solid rgba(255, 226, 150, 0.34);
  box-shadow:
    inset 0 0 0 3px rgba(3, 26, 20, 0.72),
    inset 0 0 0 4px rgba(255, 226, 150, 0.16),
    inset 0 0 0 10px rgba(0, 0, 0, 0.14),
    inset 0 0 42px rgba(255, 220, 140, 0.06),
    0 0 32px rgba(255, 215, 106, 0.11);
}

.table-rim::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 24px;
  border: 1px solid rgba(255, 226, 150, 0.12);
  box-shadow: inset 0 0 18px rgba(255, 220, 140, 0.04);
}

.corner-bracket {
  position: absolute;
  width: clamp(54px, 8vw, 96px);
  height: clamp(54px, 8vw, 96px);
  z-index: 3;
  pointer-events: none;
  opacity: 0.74;
  filter: drop-shadow(0 0 8px rgba(255, 215, 106, 0.14));
}

.corner-tl {
  top: 15px;
  left: 15px;
  border-top: 2px solid rgba(255, 226, 150, 0.34);
  border-left: 2px solid rgba(255, 226, 150, 0.34);
  border-top-left-radius: 22px;
}

.corner-tr {
  top: 15px;
  right: 15px;
  border-top: 2px solid rgba(255, 226, 150, 0.34);
  border-right: 2px solid rgba(255, 226, 150, 0.34);
  border-top-right-radius: 22px;
}

.corner-bl {
  bottom: 15px;
  left: 15px;
  border-bottom: 2px solid rgba(255, 226, 150, 0.34);
  border-left: 2px solid rgba(255, 226, 150, 0.34);
  border-bottom-left-radius: 22px;
}

.corner-br {
  bottom: 15px;
  right: 15px;
  border-bottom: 2px solid rgba(255, 226, 150, 0.34);
  border-right: 2px solid rgba(255, 226, 150, 0.34);
  border-bottom-right-radius: 22px;
}

.corner-bracket::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 226, 150, 0.28);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 215, 106, 0.16);
}

.corner-bracket::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 1px;
  background: linear-gradient(135deg, #fff3b0, #d99a2b);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(255, 215, 106, 0.45);
}

.corner-tl::before { top: -4px; left: -4px; }
.corner-tr::before { top: -4px; right: -4px; }
.corner-bl::before { bottom: -4px; left: -4px; }
.corner-br::before { bottom: -4px; right: -4px; }

.corner-tl::after { top: 13px; left: 13px; }
.corner-tr::after { top: 13px; right: 13px; }
.corner-bl::after { bottom: 13px; left: 13px; }
.corner-br::after { bottom: 13px; right: 13px; }

.floating-dust {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.floating-dust span {
  position: absolute;
  width: var(--size, 2px);
  height: var(--size, 2px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff9d8 0%, rgba(255, 221, 128, 0.7) 45%, rgba(255, 205, 80, 0) 72%);
  box-shadow: 0 0 7px rgba(255, 226, 150, 0.55);
  opacity: 0;
  animation: dustRise var(--dur, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.plate-label {
  background: linear-gradient(180deg, rgba(7, 57, 43, 0.82), rgba(3, 31, 24, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 14px rgba(0, 0, 0, 0.2);
}

.mini-card-row {
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.25));
}

.avatar {
  box-shadow:
    0 0 0 2px rgba(255, 231, 160, 0.55),
    0 0 0 6px rgba(4, 44, 34, 0.72),
    0 0 0 7px rgba(255, 215, 106, 0.15),
    0 12px 24px rgba(0, 0, 0, 0.3);
}

.avatar-wrap.is-landlord .avatar {
  box-shadow:
    0 0 0 2px #ffe49a,
    0 0 0 6px rgba(94, 45, 6, 0.72),
    0 0 0 7px rgba(255, 215, 106, 0.3),
    0 0 24px rgba(255, 188, 64, 0.36),
    0 12px 24px rgba(0, 0, 0, 0.3);
}

.avatar-wrap.is-landlord .avatar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -19px;
  width: 34px;
  height: 23px;
  transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(180deg, #fff8c9 0%, #ffd45c 42%, #c88616 100%);
  clip-path: polygon(0 100%, 5% 24%, 30% 62%, 50% 0, 70% 62%, 95% 24%, 100% 100%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.42));
  z-index: 6;
  pointer-events: none;
}

.avatar-wrap.is-farmer .avatar {
  box-shadow:
    0 0 0 2px rgba(139, 235, 198, 0.7),
    0 0 0 6px rgba(4, 52, 39, 0.72),
    0 0 0 7px rgba(67, 214, 166, 0.16),
    0 12px 24px rgba(0, 0, 0, 0.3);
}

.seat.active .avatar {
  box-shadow:
    0 0 0 2px #fff0b8,
    0 0 0 6px rgba(62, 40, 5, 0.6),
    0 0 26px rgba(255, 214, 106, 0.62),
    0 12px 24px rgba(0, 0, 0, 0.3);
}

.seat-copy {
  padding: 5px 10px 6px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(8, 58, 45, 0.88), rgba(3, 32, 25, 0.52));
  border: 1px solid rgba(255, 230, 160, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(255, 215, 106, 0.06),
    0 8px 18px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}

.seat-right .seat-copy {
  text-align: right;
}

.seat-name {
  letter-spacing: 0.5px;
}

.speech-bubble {
  background: linear-gradient(180deg, #fffefa 0%, #f8efd8 58%, #ecddba 100%);
  border: 1px solid rgba(255, 215, 106, 0.72);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 #fff,
    0 0 0 2px rgba(255, 255, 255, 0.07);
  letter-spacing: 0.2px;
}

.speech-bubble::after {
  border-top-color: #ecddba;
}

.seat-right .speech-bubble::after {
  left: auto;
  right: 8px;
  border-top-color: #ecddba;
  border-right: 7px solid #ecddba;
  border-left: 0;
  transform: rotate(12deg);
}

.seat.speaking .avatar {
  animation: voiceGlow 0.68s ease-in-out infinite alternate;
}

.seat.speaking .speech-bubble {
  animation: bubblePop 0.24s ease, bubbleGlow 0.8s ease-in-out infinite alternate;
}

.play-area::before {
  content: "";
  position: absolute;
  inset: -30px -12px;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 229, 145, 0.11), rgba(255, 215, 106, 0.035) 42%, transparent 68%);
}

.last-cards .card {
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
}

.turn-pill {
  background: linear-gradient(180deg, rgba(6, 51, 39, 0.78), rgba(2, 29, 22, 0.66));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.turn-pill[data-state="you"] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 0 22px rgba(255, 215, 106, 0.35), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.timer-pill.low {
  color: #fff4e5;
  background: linear-gradient(180deg, #ff7b63, #c92f24);
  border-color: rgba(255, 209, 175, 0.75);
  box-shadow: 0 0 18px rgba(232, 74, 60, 0.55);
  animation: timerLow 0.72s ease-in-out infinite alternate;
}

.hand-dock::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 150, 0.5), transparent);
  box-shadow: 0 0 16px rgba(255, 215, 106, 0.28);
}

.hand-dock::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -44px;
  width: min(760px, 92vw);
  height: 170px;
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 214, 106, 0.1), transparent 70%);
}

.game-btn {
  overflow: hidden;
}

.game-btn::before {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -35%;
  width: 28%;
  transform: rotate(18deg) translateX(-180%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  pointer-events: none;
  transition: transform 0.55s ease;
}

.game-btn:hover::before {
  transform: rotate(18deg) translateX(620%);
}

.game-btn:focus-visible,
.icon-btn:focus-visible,
.text-btn:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid rgba(255, 231, 160, 0.9);
  outline-offset: 2px;
}

.help-note {
  margin: 14px auto 0;
  max-width: 560px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 233, 163, 0.7);
}

.overlay {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 214, 106, 0.08), transparent 42%),
    rgba(2, 16, 12, 0.76);
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 44px rgba(255, 220, 140, 0.07);
}

.result-ribbon {
  animation: ribbonFloat 3.4s ease-in-out infinite;
}

@keyframes topLine {
  0%, 100% { opacity: 0.45; transform: scaleX(0.86); }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes titleSheen {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes stageBreathe {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) scale(0.98); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
}

@keyframes lightSweep {
  0% { transform: translateX(-30%) rotate(8deg); }
  100% { transform: translateX(30%) rotate(8deg); }
}

@keyframes emblemFloat {
  0%, 100% { opacity: 0.78; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.96; transform: translate(-50%, -51%) scale(1.025); }
}

@keyframes dustRise {
  0% { opacity: 0; transform: translate3d(0, 20px, 0) scale(0.7); }
  16% { opacity: 0.85; }
  72% { opacity: 0.45; }
  100% { opacity: 0; transform: translate3d(var(--dx, 12px), -110px, 0) scale(0.35); }
}

@keyframes voiceGlow {
  from {
    filter: drop-shadow(0 0 10px rgba(255, 222, 133, 0.55)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
    transform: translateY(-1px) scale(1.01);
  }
  to {
    filter: drop-shadow(0 0 24px rgba(255, 236, 170, 0.95)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
    transform: translateY(-3px) scale(1.045);
  }
}

@keyframes bubbleGlow {
  from { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 #fff, 0 0 0 rgba(255, 215, 106, 0); }
  to { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 #fff, 0 0 18px rgba(255, 215, 106, 0.55); }
}

@keyframes timerLow {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.06); filter: brightness(1.2); }
}

@keyframes ribbonFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

@media (max-width: 760px) {
  .corner-bracket {
    opacity: 0.4;
  }

  .stage-light {
    top: 32%;
    height: 46vh;
  }

  .ambient-sweep {
    opacity: 0.28;
  }

  .seat-copy {
    padding: 4px 8px 5px;
  }

  .speech-bubble {
    font-size: 13px;
    padding: 6px 11px;
  }
}

@media (max-width: 760px) {
  :root {
    --card-w: 56px;
    --card-h: 82px;
    --dock-h: 176px;
  }

  .topbar {
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px;
    gap: 8px;
  }

  .brand-badge {
    width: 34px;
    height: 34px;
  }

  .brand-sub {
    display: none;
  }

  .stat-chip {
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
    gap: 4px;
  }

  .stat-chip strong {
    font-size: 14px;
  }

  .round-chip {
    display: none;
  }

  .text-btn {
    padding: 0 10px;
    font-size: 13px;
  }

  .seat-side {
    width: 170px;
    top: 13%;
  }

  .seat-left {
    left: 8px;
  }

  .seat-right {
    right: 8px;
  }

  .avatar {
    width: 58px;
    height: 58px;
  }

  .seat-bottom {
    left: 8px;
    bottom: calc(var(--dock-h) + 2px);
  }

  .seat-bottom .avatar {
    width: 52px;
    height: 52px;
  }

  .seat-name {
    font-size: 13px;
  }

  .seat-beans {
    font-size: 11px;
  }

  .count-badge {
    left: 44px;
    font-size: 11px;
    padding: 2px 7px;
  }

  .seat-right .count-badge {
    right: 44px;
  }

  .mini-hand {
    top: 54px;
    left: 34px;
    height: 48px;
  }

  .seat-right .mini-hand {
    right: 34px;
  }

  .mini-hand .card {
    width: 28px;
    height: 40px;
    margin-left: -19px;
  }

  .seat-right .mini-hand .card {
    margin-right: -19px;
  }

  .speech-bubble {
    left: 60px;
    font-size: 13px;
    padding: 6px 11px;
  }

  .seat-right .speech-bubble {
    right: 60px;
  }

  .play-area {
    top: 43%;
    width: 92%;
    min-height: 128px;
    gap: 10px;
  }

  .turn-pill {
    font-size: 12px;
    padding: 6px 13px;
  }

  .mini-card-row .card {
    width: 40px;
    height: 58px;
    margin-left: -7px;
  }

  .last-cards[data-density="small"] .card {
    width: 34px;
    height: 50px;
  }

  .last-cards[data-density="small"] .pip-center {
    font-size: 16px;
  }

  .last-cards[data-density="small"] .face-letter,
  .last-cards[data-density="small"] .face-letter.rank-2 {
    font-size: 14px;
  }

  .last-cards[data-density="tiny"] .card {
    width: 30px;
    height: 44px;
  }

  .last-cards[data-density="tiny"] .corner-rank {
    font-size: 8px;
  }

  .last-cards[data-density="tiny"] .pip-center {
    font-size: 13px;
  }

  .last-cards[data-density="tiny"] .face-letter,
  .last-cards[data-density="tiny"] .face-letter.rank-2 {
    font-size: 12px;
  }

  .last-cards[data-density="tiny"] .joker-center span {
    font-size: 10px;
  }

  .game-btn {
    min-width: 62px;
    height: 40px;
    padding: 0 12px;
    font-size: 15px;
    border-radius: 13px;
  }

  .control-group {
    gap: 7px;
  }

  .timer-pill {
    height: 32px;
    min-width: 48px;
    font-size: 13px;
  }

  .selection-label {
    bottom: calc(100% + 4px);
    font-size: 12px;
  }

  .hand {
    bottom: calc(4px + var(--safe-bottom));
    height: calc(var(--card-h) + 30px);
  }

  .card-corner {
    top: 4px;
    left: 5px;
  }

  .corner-flip {
    right: 5px;
    bottom: 4px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 24px 18px;
  }
}

@media (max-width: 400px) {
  :root {
    --card-w: 50px;
    --card-h: 74px;
    --dock-h: 164px;
  }

  .brand-title {
    font-size: 17px;
  }

  .multiplier-chip .mul-label {
    display: none;
  }

  .game-btn {
    min-width: 56px;
    padding: 0 9px;
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .topbar {
    gap: 5px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .brand {
    gap: 6px;
  }

  .brand-badge {
    width: 30px;
    height: 30px;
  }

  .brand-title {
    font-size: 15px;
    letter-spacing: 0;
  }

  .top-stats {
    gap: 5px;
  }

  .stat-chip {
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .stat-chip strong {
    font-size: 13px;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .text-btn {
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }
}

@media (max-width: 340px) {
  .brand-title {
    font-size: 13px;
  }

  .brand-badge {
    width: 28px;
    height: 28px;
  }

  .stat-chip {
    padding: 0 6px;
    font-size: 10px;
  }

  .stat-chip strong {
    font-size: 12px;
  }

  .top-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .text-btn {
    height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }
}

@media (max-height: 700px) and (min-width: 761px) {
  :root {
    --card-w: 64px;
    --card-h: 92px;
    --dock-h: 190px;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }

  .seat-side {
    top: 13%;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  :root {
    --card-w: 50px;
    --card-h: 72px;
    --dock-h: 142px;
  }

  .topbar {
    height: 46px;
  }

  .brand-sub {
    display: none;
  }

  .seat-side {
    top: 10%;
  }

  .avatar {
    width: 50px;
    height: 50px;
  }

  .mini-hand {
    top: 46px;
  }

  .play-area {
    top: 40%;
    min-height: 104px;
  }

  .bottom-cards {
    top: 4px;
  }

  .game-btn {
    height: 36px;
  }

  .help-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .desktop-scene {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .desktop-scene svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  .desktop-wood {
    display: block;
    position: absolute;
    left: 2%;
    right: 2%;
    top: 32%;
    bottom: -30%;
    z-index: 1;
    pointer-events: none;
    border-radius: 50% 50% 48% 48% / 32% 32% 68% 68%;
    border: 1px solid rgba(255, 229, 165, 0.42);
    background:
      radial-gradient(ellipse at 50% 8%, rgba(255, 246, 205, 0.55), transparent 42%),
      repeating-linear-gradient(92deg, rgba(95, 52, 8, 0.12) 0 2px, transparent 2px 13px),
      repeating-linear-gradient(3deg, rgba(255, 228, 150, 0.08) 0 1px, transparent 1px 9px),
      radial-gradient(ellipse at 50% 35%, #e8b865 0%, #cf933a 42%, #a4631c 72%, #6b3a0b 100%);
    box-shadow:
      inset 0 18px 55px rgba(255, 245, 205, 0.25),
      inset 0 -40px 90px rgba(58, 28, 3, 0.5),
      inset 0 0 0 8px rgba(92, 50, 8, 0.65),
      inset 0 0 0 10px rgba(255, 222, 140, 0.35),
      0 36px 80px rgba(0, 0, 0, 0.45);
  }

  .desktop-wood::before {
    content: "欢乐斗地主";
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%) rotate(-6deg);
    font-family: KaiTi, STKaiti, serif;
    font-size: clamp(42px, 6vw, 82px);
    font-weight: 900;
    letter-spacing: 12px;
    color: rgba(92, 45, 5, 0.16);
    text-shadow: 0 1px 0 rgba(255, 244, 200, 0.14);
    white-space: nowrap;
  }

  .desktop-wood::after {
    content: "";
    position: absolute;
    inset: 5% 8% 20%;
    border-radius: 50%;
    border: 1px solid rgba(255, 227, 160, 0.16);
    box-shadow: inset 0 0 70px rgba(255, 236, 180, 0.08);
  }

  .table {
    background: #173442;
    border-top-color: rgba(255, 215, 106, 0.28);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.34);
  }

  .felt-pattern,
  .felt-ring,
  .table-emblem,
  .table-rim,
  .corner-bracket {
    display: none;
  }

  .table-vignette {
    z-index: 3;
    background: radial-gradient(ellipse at 50% 34%, transparent 40%, rgba(3, 20, 30, 0.28) 78%, rgba(0, 10, 18, 0.55) 100%);
  }

  .stage-light {
    z-index: 2;
    top: 28%;
    opacity: 0.75;
    background: radial-gradient(ellipse at center, rgba(255, 244, 203, 0.22), rgba(255, 221, 128, 0.08) 38%, transparent 70%);
  }

  .ambient-sweep {
    z-index: 2;
    opacity: 0.26;
  }

  .floating-dust {
    z-index: 3;
  }

  .topbar {
    background: linear-gradient(180deg, rgba(8, 39, 55, 0.95), rgba(5, 24, 36, 0.9));
    border-bottom-color: rgba(255, 215, 106, 0.32);
  }

  .seat-copy {
    background: linear-gradient(135deg, rgba(48, 28, 8, 0.84), rgba(23, 13, 5, 0.58));
    border-color: rgba(255, 220, 150, 0.28);
  }

  .count-badge {
    background: rgba(42, 22, 5, 0.84);
    border-color: rgba(255, 215, 106, 0.48);
  }

  .seat-side .avatar {
    width: 84px;
    height: 84px;
  }

  .avatar-wrap {
    gap: 12px;
  }

  .game-btn {
    height: 46px;
    border-radius: 15px;
    font-size: 17px;
  }

  .timer-pill,
  .selection-label {
    background: rgba(44, 24, 5, 0.8);
    border-color: rgba(255, 215, 106, 0.42);
  }

  .turn-pill {
    background: linear-gradient(180deg, rgba(70, 39, 8, 0.82), rgba(35, 18, 4, 0.72));
    border-color: rgba(255, 215, 106, 0.28);
  }

  .hand-dock {
    background: linear-gradient(180deg, transparent 0%, rgba(70, 38, 8, 0.28) 34%, rgba(44, 23, 4, 0.72) 100%);
  }

  .play-area {
    top: 44%;
  }

  .play-area::before {
    background: radial-gradient(ellipse at center, rgba(255, 238, 179, 0.16), rgba(255, 215, 106, 0.05) 42%, transparent 68%);
  }
}

@media (min-width: 1000px) and (min-height: 700px) {
  .seat-bottom .avatar {
    width: 104px;
    height: 104px;
  }
}
@media (min-width: 900px) {
  .hand .card {
    transform: translateY(var(--lift));
  }

  .game-btn.teal {
    background: linear-gradient(180deg, #6ed1ff, #2497e6 58%, #1266b0);
  }
}
@media (min-width: 900px) {
  .desktop-wood {
    border: 2px solid rgba(255, 229, 165, 0.55);
    box-shadow:
      inset 0 18px 55px rgba(255, 245, 205, 0.28),
      inset 0 -40px 90px rgba(58, 28, 3, 0.52),
      inset 0 0 0 11px rgba(92, 50, 8, 0.68),
      inset 0 0 0 14px rgba(255, 222, 140, 0.42),
      inset 0 0 0 17px rgba(70, 38, 6, 0.35),
      0 36px 80px rgba(0, 0, 0, 0.45);
  }
}
@media (min-width: 900px) {
  .scene-btn {
    display: none;
  }
}
.avatar svg {
  display: none;
}

.avatar-a {
  background-image: url("../assets/avatars/afu.png");
  background-size: cover;
  background-position: center;
}

.avatar-b {
  background-image: url("../assets/avatars/xiaocui.png");
  background-size: cover;
  background-position: center;
}

.avatar-c {
  background-image: url("../assets/avatars/me.png");
  background-size: cover;
  background-position: center;
}

.avatar-wrap.is-landlord .avatar-a,
.avatar-wrap.is-landlord .avatar-b,
.avatar-wrap.is-landlord .avatar-c {
  background-image: url("../assets/avatars/landlord.png");
}
@media (min-width: 900px) {
  .desktop-scene {
    display: none !important;
  }

  .desktop-wood {
    display: block !important;
  }

  .table {
    background:
      radial-gradient(ellipse at 50% 18%, rgba(255, 236, 170, 0.09), transparent 36%),
      radial-gradient(ellipse at 50% 46%, rgba(29, 178, 129, 0.52), transparent 58%),
      radial-gradient(ellipse at 50% 118%, rgba(0, 0, 0, 0.5), transparent 62%),
      radial-gradient(ellipse at 50% 50%, var(--felt) 0%, var(--felt-dark) 72%, #033326 100%);
    border-top: 1px solid rgba(255, 226, 150, 0.12);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.42);
  }

  .table-vignette {
    z-index: 2;
    background: radial-gradient(ellipse at 50% 48%, transparent 34%, rgba(1, 16, 12, 0.28) 76%, rgba(0, 8, 6, 0.55) 100%);
  }
}

.avatar,
.avatar-wrap .avatar {
  width: 88px;
  height: 144px;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  filter: drop-shadow(0 9px 9px rgba(0, 0, 0, 0.34));
}

.avatar-wrap.is-landlord .avatar,
.avatar-wrap.is-farmer .avatar,
.seat.active .avatar {
  box-shadow: none;
}

.seat-side .avatar {
  width: 94px;
  height: 154px;
}

.seat-bottom .avatar {
  width: 80px;
  height: 132px;
}

.seat.active .avatar::after {
  display: none;
}

.avatar-a {
  background-image: url("../assets/avatars/male-stand.png");
}

.avatar-b {
  background-image: url("../assets/avatars/female-stand.png");
}

.avatar-c {
  background-image: url("../assets/avatars/male-stand.png");
}

.avatar-wrap.is-landlord .avatar-a {
  background-image: url("../assets/avatars/male-stand.png");
}

.avatar-wrap.is-landlord .avatar-b {
  background-image: url("../assets/avatars/female-stand.png");
}

.avatar-wrap.is-landlord .avatar-c {
  background-image: url("../assets/avatars/male-stand.png");
}

.avatar-wrap.is-thinking .avatar-a,
.avatar-wrap.is-thinking .avatar-c {
  background-image: url("../assets/avatars/male-think.png");
}

.avatar-wrap.is-thinking .avatar-b {
  background-image: url("../assets/avatars/female-think.png");
}

.avatar-wrap.is-winning .avatar-a,
.avatar-wrap.is-winning .avatar-c {
  background-image: url("../assets/avatars/male-win.png");
}

.avatar-wrap.is-winning .avatar-b {
  background-image: url("../assets/avatars/female-win.png");
}

.avatar-wrap.is-landlord .avatar {
  filter:
    drop-shadow(0 0 12px rgba(255, 191, 63, 0.45))
    drop-shadow(0 9px 9px rgba(0, 0, 0, 0.34));
}

.avatar-wrap {
  align-items: center;
  gap: 9px;
}

.avatar-wrap.is-landlord .avatar::before {
  top: -12px;
  width: 38px;
  height: 25px;
}

.speech-bubble {
  top: -8px;
  left: 96px;
}

.seat-right .speech-bubble {
  right: 96px;
}

.seat-bottom .speech-bubble {
  left: 88px;
}

.count-badge {
  left: 94px;
}

.seat-right .count-badge {
  right: 94px;
}

.mini-hand {
  left: 94px;
  top: 98px;
}

.seat-right .mini-hand {
  right: 94px;
}

@media (max-width: 760px) {
  .avatar,
  .avatar-wrap .avatar {
    width: 66px;
    height: 108px;
  }

  .seat-side .avatar {
    width: 72px;
    height: 118px;
  }

  .seat-bottom .avatar {
    width: 62px;
    height: 102px;
  }

  .avatar-wrap {
    gap: 6px;
  }

  .avatar-wrap.is-landlord .avatar::before {
    top: -8px;
    width: 30px;
    height: 20px;
  }

  .speech-bubble {
    top: -6px;
    left: 72px;
  }

  .seat-right .speech-bubble {
    right: 72px;
  }

  .seat-bottom .speech-bubble {
    left: 66px;
  }

  .count-badge {
    left: 68px;
  }

  .seat-right .count-badge {
    right: 68px;
  }

  .mini-hand {
    left: 68px;
    top: 74px;
  }

  .seat-right .mini-hand {
    right: 68px;
  }

  .role-badge {
    bottom: -4px;
    padding: 1px 7px;
    font-size: 10px;
  }
}

@media (max-width: 340px) {
  .avatar,
  .avatar-wrap .avatar {
    width: 60px;
    height: 98px;
  }

  .seat-side .avatar {
    width: 64px;
    height: 106px;
  }

  .seat-bottom .avatar {
    width: 58px;
    height: 94px;
  }
}

@media (max-height: 700px) and (min-width: 761px) {
  .avatar,
  .avatar-wrap .avatar {
    width: 84px;
    height: 138px;
  }

  .seat-side .avatar {
    width: 90px;
    height: 146px;
  }

  .seat-bottom .avatar {
    width: 76px;
    height: 126px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .avatar,
  .avatar-wrap .avatar {
    width: 54px;
    height: 88px;
  }

  .seat-side .avatar {
    width: 60px;
    height: 98px;
  }

  .seat-bottom .avatar {
    width: 52px;
    height: 86px;
  }

  .speech-bubble {
    top: -6px;
    left: 64px;
  }

  .seat-right .speech-bubble {
    right: 64px;
  }

  .seat-bottom .speech-bubble {
    left: 58px;
  }

  .count-badge {
    left: 60px;
  }

  .seat-right .count-badge {
    right: 60px;
  }

  .mini-hand {
    left: 60px;
    top: 58px;
  }

  .seat-right .mini-hand {
    right: 60px;
  }
}

@media (min-width: 900px) {
  .avatar,
  .avatar-wrap .avatar {
    width: 104px;
    height: 170px;
  }

  .seat-side .avatar {
    width: 110px;
    height: 180px;
  }

  .seat-bottom .avatar {
    width: 100px;
    height: 164px;
  }

  .avatar-wrap {
    gap: 12px;
  }

  .speech-bubble {
    left: 112px;
  }

  .seat-right .speech-bubble {
    right: 112px;
  }

  .seat-bottom .speech-bubble {
    left: 104px;
  }

  .count-badge {
    left: 110px;
  }

  .seat-right .count-badge {
    right: 110px;
  }

  .mini-hand {
    left: 110px;
    top: 104px;
  }

  .seat-right .mini-hand {
    right: 110px;
  }
}

@media (min-width: 1000px) and (min-height: 700px) {
  .seat-side .avatar {
    width: 118px;
    height: 192px;
  }

  .seat-bottom .avatar {
    width: 112px;
    height: 182px;
  }
}

.avatar-wrap.is-landlord .avatar-a,
.avatar-wrap.is-landlord .avatar-b,
.avatar-wrap.is-landlord .avatar-c {
  background-image: url("../assets/avatars/landlord-full.png");
}

.avatar-wrap.is-landlord .avatar::before {
  display: none;
}

@media (min-width: 900px) and (max-height: 800px) {
  .seat-side {
    top: 9%;
  }

  .seat-side .avatar {
    width: 104px;
    height: 170px;
  }

  .seat-bottom .avatar {
    width: 94px;
    height: 152px;
  }
}

@media (min-width: 900px) and (max-height: 620px) {
  .seat-side {
    top: 7%;
  }

  .seat-side .avatar {
    width: 82px;
    height: 134px;
  }

  .seat-bottom .avatar {
    width: 76px;
    height: 122px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .seat-side {
    top: 4%;
  }

  .seat-side .avatar {
    width: 50px;
    height: 78px;
  }

  .seat-bottom .avatar {
    width: 46px;
    height: 72px;
  }
}

.desktop-scene,
.desktop-wood {
  display: none !important;
}

.table {
  background:
    linear-gradient(180deg, rgba(3, 18, 13, 0.1), rgba(2, 12, 9, 0.24)),
    url("../assets/bg-computer.png") center / cover no-repeat;
}

@media (max-width: 760px) and (orientation: portrait) {
  .table {
    background:
      linear-gradient(180deg, rgba(3, 18, 13, 0.08), rgba(2, 12, 9, 0.22)),
      url("../assets/bg-mobile.png") center / cover no-repeat;
  }
}

.trustee-btn.active {
  color: #462600;
  background: linear-gradient(180deg, #ffe9a3, #f6c453 62%, #dd8f1c);
  border-color: rgba(255, 247, 209, 0.72);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.app.trustee .hand {
  pointer-events: none;
}

.counter-panel {
  position: fixed;
  top: calc(66px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 80;
  width: min(330px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.14), transparent 50%),
    linear-gradient(180deg, rgba(8, 60, 46, 0.97), rgba(3, 30, 23, 0.96));
  border: 1px solid rgba(246, 196, 83, 0.46);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.counter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 9px;
  color: #ffe8a8;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
}

.counter-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #f9efd2;
  font-size: 18px;
  line-height: 22px;
  cursor: pointer;
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.counter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 7px;
  border-radius: 9px;
  background: rgba(2, 25, 18, 0.72);
  border: 1px solid rgba(255, 230, 160, 0.14);
  color: #f8edcd;
  font-size: 12px;
}

.counter-item b {
  color: #ffd76a;
  font-size: 14px;
}

.counter-item.out {
  opacity: 0.46;
}

.counter-item.out b {
  color: #ff8b7c;
}

.counter-rank {
  font-weight: 900;
}

.counter-note {
  padding-top: 8px;
  color: rgba(255, 238, 194, 0.52);
  font-size: 10px;
  text-align: center;
}

.start-card {
  position: relative;
  width: min(430px, 92vw);
  padding: 38px 28px 26px;
  text-align: center;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.2), transparent 46%),
    linear-gradient(180deg, #0b4b3b, #062a21);
  border: 1.5px solid rgba(246, 196, 83, 0.55);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.overlay.show .start-card {
  transform: translateY(0) scale(1);
}

.start-kicker {
  color: #f6c453;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 7px;
}

.start-title {
  margin: 12px 0 8px;
  color: #fff4d3;
  font-family: KaiTi, STKaiti, serif;
  font-size: clamp(34px, 8vw, 46px);
  line-height: 1.1;
  letter-spacing: 4px;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.start-sub {
  margin: 0 0 24px;
  color: rgba(255, 241, 205, 0.72);
  font-size: 13px;
}

.start-card .game-btn.wide {
  width: 100%;
}

.start-note {
  margin-top: 14px;
  color: rgba(255, 238, 194, 0.46);
  font-size: 10px;
  letter-spacing: 1px;
}

@media (min-width: 761px) {
  .counter-panel {
    top: auto;
    right: 16px;
    bottom: calc(var(--dock-h) + 14px);
  }
}

.result-card {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.result-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.result-hands {
  display: grid;
  gap: 7px;
  margin: 14px 0 18px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 230, 160, 0.16);
}

.result-hand-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 46px;
}

.result-hand-name {
  flex: 0 0 42px;
  padding-top: 4px;
  color: #ffe8a8;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.result-hand-name.landlord {
  color: #ffbd5a;
}

.result-hand-cards {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: 3px;
}

.result-hand-cards .card {
  width: 32px;
  height: 44px;
  border-radius: 5px;
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.22);
}

.result-hand-cards .card-corner {
  top: 2px;
  left: 3px;
}

.result-hand-cards .corner-rank {
  font-size: 10px;
}

.result-hand-cards .corner-suit {
  margin-top: 1px;
  font-size: 8px;
}

.result-hand-cards .corner-flip {
  top: auto;
  left: auto;
  right: 3px;
  bottom: 2px;
}

.result-hand-cards .pip-center {
  font-size: 16px;
}

.result-hand-cards .face-letter {
  font-size: 16px;
}

.result-hand-cards .face-letter.rank-2 {
  font-size: 15px;
}

.result-hand-cards .face-suit {
  font-size: 8px;
}

.result-hand-cards .joker-center span {
  font-size: 9px;
}

.result-hand-empty {
  color: #ffd76a;
  font-size: 12px;
  font-weight: 800;
}

.result-hand-count {
  flex: 0 0 30px;
  padding-top: 4px;
  color: rgba(255, 238, 194, 0.62);
  font-size: 11px;
  text-align: right;
}

@media (max-width: 760px) {
  .top-actions {
    gap: 4px;
  }

  .counter-btn,
  .trustee-btn {
    padding: 0 8px;
    font-size: 12px;
  }

  .counter-panel {
    top: calc(58px + env(safe-area-inset-top, 0px));
    right: 8px;
    width: calc(100vw - 16px);
  }
}

@media (max-width: 520px) {
  .brand {
    gap: 6px;
  }

  .brand-badge {
    width: 30px;
    height: 30px;
  }

  .brand-title {
    font-size: 14px;
    letter-spacing: 0;
  }

  .brand-sub {
    display: none;
  }

  .top-stats {
    gap: 5px;
  }

  .stat-chip {
    padding: 0 7px;
    font-size: 12px;
  }

  .round-chip {
    display: none;
  }

  .top-actions {
    gap: 3px;
  }

  .top-actions .icon-btn {
    width: 32px;
  }

  .top-actions .text-btn {
    padding: 0 6px;
    font-size: 11px;
    white-space: nowrap;
  }
}

.avatar-c,
.avatar-wrap.is-thinking .avatar-c,
.avatar-wrap.is-winning .avatar-c,
.avatar-wrap.is-landlord .avatar-c {
  background-image: url("../assets/avatars/me-full.png");
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

@media (max-width: 520px) {
  .brand-title {
    font-size: 12px;
  }
}

.overlay {
  backdrop-filter: none;
}

.mini-card-row .suit-big {
  right: 5px;
  bottom: 3px;
  font-size: 24px;
}

.mini-card-row .joker-vertical {
  top: 3px;
  bottom: 3px;
  left: 4px;
  font-size: 9px;
}

.mini-card-row .joker-silhouette {
  right: 4px;
  bottom: 3px;
}

.last-cards[data-density="small"] .suit-big {
  right: 4px;
  bottom: 3px;
  font-size: 22px;
}

.last-cards[data-density="small"] .joker-vertical {
  top: 3px;
  bottom: 3px;
  left: 4px;
  font-size: 8px;
}

.last-cards[data-density="tiny"] .suit-big {
  right: 4px;
  bottom: 2px;
  font-size: 20px;
}

.last-cards[data-density="tiny"] .joker-vertical {
  top: 3px;
  bottom: 3px;
  left: 3px;
  font-size: 7px;
}

.result-hand-cards .suit-big {
  right: 4px;
  bottom: 3px;
  font-size: 18px;
}

.result-hand-cards .joker-vertical {
  top: 2px;
  bottom: 2px;
  left: 3px;
  font-size: 7px;
}

.result-hand-cards .joker-silhouette {
  right: 3px;
  bottom: 2px;
}

.hand-dock::before {
  display: none;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0 0 16px;
}

.mode-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 230, 160, 0.22);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 242, 205, 0.68);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mode-option strong {
  font-size: 14px;
  color: #ffe8a8;
}

.mode-option span {
  font-size: 10px;
  letter-spacing: 0.3px;
}

.mode-option.active {
  border-color: rgba(255, 215, 106, 0.78);
  background: linear-gradient(180deg, rgba(246, 196, 83, 0.24), rgba(246, 196, 83, 0.08));
  color: rgba(255, 246, 218, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.seat-top {
  display: none;
}

.mode-four .seat-top {
  display: block;
  top: 100px;
  left: 50%;
  z-index: 15;
  width: 220px;
  transform: translateX(-50%);
}

.seat-top .avatar-wrap {
  flex-direction: row;
  justify-content: center;
  gap: 8px;
}

.seat-top .avatar {
  width: 70px;
  height: 112px;
}

.seat-top .seat-copy {
  padding: 5px 9px;
  text-align: left;
}

.seat-top .mini-hand {
  display: none;
}

.seat-top .count-badge {
  top: 18px;
  left: auto;
  right: -2px;
}

.seat-top .speech-bubble {
  top: auto;
  bottom: -34px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border-radius: 14px;
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}

.seat-top .speech-bubble::after {
  left: 50%;
  right: auto;
  top: -7px;
  bottom: auto;
  border: 7px solid transparent;
  border-top-color: transparent;
  border-bottom-color: #ecddba;
  border-right: 7px solid transparent;
  border-left: 7px solid transparent;
  transform: translateX(-50%) rotate(0deg);
}

.mode-four .bottom-cards {
  top: 5px;
}

.mode-four .play-area {
  top: 47%;
}

.avatar-d {
  background-image: url("../assets/avatars/afu-full.png");
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.avatar-wrap.is-landlord .avatar-d {
  background-image: url("../assets/avatars/landlord-full.png");
}

@media (max-width: 760px) {
  .mode-four .seat-side {
    top: 23%;
  }

  .mode-four .seat-top {
    top: 98px;
    width: 168px;
  }

  .seat-top .avatar {
    width: 58px;
    height: 94px;
  }

  .seat-top .seat-copy {
    padding: 3px 7px;
  }

  .seat-top .seat-name {
    font-size: 13px;
  }

  .seat-top .seat-beans {
    margin-top: 2px;
    font-size: 11px;
  }

  .seat-top .count-badge {
    top: 16px;
    right: -4px;
  }
}

@media (max-width: 400px) {
  .mode-four .seat-top {
    top: 98px;
  }
}

@media (max-width: 520px) {
  .control-group {
    gap: 6px;
  }

  #biddingControls .game-btn {
    padding: 0 11px;
    font-size: 14px;
    letter-spacing: 0;
  }
}

.game-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 230, 160, 0.14);
}

.game-links-label {
  width: 100%;
  color: rgba(255, 238, 194, 0.46);
  font-size: 10px;
  letter-spacing: 2px;
}

.game-link {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 160, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #ffe8a8;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.game-link small {
  color: rgba(255, 238, 194, 0.5);
  font-size: 9px;
  font-weight: 500;
}

.game-link:hover {
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(246, 196, 83, 0.14);
}

  .seat-top .avatar {
    width: 54px;
    height: 88px;
  }
}

.wallet-ad {
  z-index: 12000;
}

.ad-card {
  width: min(380px, 92vw);
  padding: 24px 22px 20px;
  text-align: center;
}

.ad-badge {
  display: inline-flex;
  height: 20px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 241, 205, 0.72);
  font-size: 10px;
  letter-spacing: 2px;
}

.ad-title {
  margin: 10px 0 14px;
  color: #fff4d3;
  font-size: 21px;
  font-weight: 900;
}

.ad-screen {
  display: flex;
  height: 128px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 230, 160, 0.2);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 236, 170, 0.22), transparent 55%),
    linear-gradient(145deg, #196c52, #083a2d);
}

.ad-screen-inner {
  color: rgba(255, 246, 216, 0.7);
  font-family: KaiTi, STKaiti, serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 5px;
}

.ad-count {
  margin: 11px 0 10px;
  color: #ffd76a;
  font-size: 28px;
  font-weight: 900;
}

.ad-note {
  margin-top: 12px;
  color: rgba(255, 238, 194, 0.46);
  font-size: 10px;
}

.version-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 6px;
}

.home-brand {
  margin: 8px 0 20px;
  font-size: clamp(42px, 11vw, 60px);
  letter-spacing: 6px;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.42);
}

.version-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 158px;
  padding: 18px 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 230, 160, 0.3);
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0.2));
  color: #fff2c9;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.version-card.online {
  border-color: rgba(124, 224, 180, 0.32);
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 224, 180, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0.2));
}

.version-card strong {
  font-family: KaiTi, STKaiti, serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffe9a3;
}

.version-card span {
  color: rgba(255, 241, 205, 0.68);
  font-size: 11px;
  line-height: 1.6;
}

.version-card em {
  margin-top: auto;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe9a3, #f6c453 62%, #dd8f1c);
  color: #462600;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.version-card.online em {
  background: linear-gradient(180deg, #b8f4d8, #6fdcae 62%, #2f9e73);
  color: #063a29;
}

.version-card:hover,
.version-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 215, 106, 0.72);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  outline: none;
}

.home-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto 10px;
  padding: 3px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 238, 194, 0.58);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.home-back:hover {
  color: #ffe9a3;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 380px) {
  .version-picker {
    grid-template-columns: 1fr;
  }

  .version-card {
    min-height: 0;
  }
}

.version-switch {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid rgba(255, 230, 160, 0.16);
  background: rgba(0, 0, 0, 0.18);
}

.version-option {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 10px;
  color: #ffe5a8;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.version-option:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff4d3;
}

.version-option.active {
  background: linear-gradient(180deg, #ffe9a3, #f6c453 62%, #dd8f1c);
  color: #462600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.version-switch {
  border-radius: 2px;
}

.version-option {
  border: 1px solid rgba(255, 230, 160, 0.22);
  border-radius: 2px;
}

.version-option.active {
  border-color: rgba(255, 247, 209, 0.8);
}

.audio-panel {
  position: fixed;
  top: calc(62px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 13000;
  width: min(260px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(246, 196, 83, 0.5);
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 196, 83, 0.14), transparent 54%),
    linear-gradient(180deg, rgba(8, 60, 46, 0.98), rgba(3, 30, 23, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  color: #f7f2df;
}

.audio-panel-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #f9efd2;
  font-size: 17px;
  line-height: 22px;
  cursor: pointer;
}

.audio-panel-title {
  padding: 0 26px 10px 2px;
  color: #ffe8a8;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
}

.audio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
  color: rgba(255, 241, 205, 0.72);
  font-size: 11px;
}

.audio-toggle {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 230, 160, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #ffe8a8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.audio-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.audio-volume-row strong {
  color: #ffd76a;
  font-size: 12px;
}

.audio-slider {
  width: 100%;
  height: 20px;
  margin: 2px 0 8px;
  accent-color: #f6c453;
  cursor: pointer;
}

@media (max-width: 520px) {
  .online-sound-btn {
    padding: 0 6px;
    font-size: 11px;
  }

  .audio-panel {
    top: calc(58px + env(safe-area-inset-top, 0px));
    right: 8px;
  }
}

.topbar {
  z-index: 12000;
}

#gameOverOverlay,
#sgResultOverlay,
#onlineResultOverlay,
#onlineWalletOverlay,
#privateOverlay,
#helpOverlay {
  z-index: 12500;
}

.wallet-ad {
  z-index: 12600;
}

#startOverlay {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 226, 150, 0.12), transparent 46%),
    rgba(2, 20, 15, 0.34);
}

