* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Daer Tile";
  src:
    local("Songti SC Black"),
    local("STSongti-SC-Black"),
    local("Songti SC Bold"),
    local("STSongti-SC-Bold"),
    local("STKaiti"),
    local("Kaiti SC Bold");
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 24, 20, 0.02), rgba(8, 24, 20, 0.12)),
    url("./assets/scenes/tea-sea-morning-v2.jpg?v=20260717-mobile-fullscreen-1") center center / cover no-repeat,
    #153331;
  color: #241b13;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --tile-font: "Daer Tile", "Songti SC Black", "STSongti-SC-Black", "Songti SC Bold", "STSongti-SC-Bold", "STKaiti", "Kaiti SC", "KaiTi", "STSong", serif;
  --tile-paper: #fffdf6;
  --tile-border: #d7c2a0;
  --tile-ink-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.card-glyph {
  display: block;
  width: 72%;
  height: 54%;
  object-fit: contain;
  object-position: center;
  transform: translate(var(--glyph-x, 0%), var(--glyph-y, 0%)) scale(var(--glyph-scale-x, 1), var(--glyph-scale-y, 1));
  transform-origin: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.game-frame {
  width: var(--mobile-viewport-width, 100vw);
  height: 100vh;
  height: var(--mobile-viewport-height, 100dvh);
  min-width: 900px;
  min-height: 500px;
  padding: 10px 16px 14px;
  background:
    linear-gradient(180deg, rgba(8, 24, 20, 0.02), rgba(8, 24, 20, 0.12)),
    url("./assets/scenes/tea-sea-morning-v2.jpg?v=20260717-temp-test-1") center center / cover no-repeat,
    #153331;
}

html[data-game-frame-fit="scaled"] .game-frame {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 900px;
  height: 500px;
  min-width: 900px;
  min-height: 500px;
  transform: translate(-50%, -50%) scale(var(--game-frame-scale, 1));
  transform-origin: center;
  background: transparent;
}

.top-scene {
  height: 82px;
  position: relative;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: transparent;
}

.top-scene::before {
  content: "";
  position: absolute;
  inset: 46px 0 auto;
  height: 20px;
  display: none;
}

.top-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  display: none;
}

.top-scene .mountain,
.top-scene .terrace {
  display: none;
}

.menu-pill,
.gift {
  position: absolute;
  top: 12px;
  z-index: 5;
  min-width: 44px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(58, 38, 42, 0.78);
  color: #ffe1a1;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(38, 20, 10, 0.28);
}

.menu-pill {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 260;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
  cursor: pointer;
}

.menu-pill span {
  margin-left: 3px;
  font-size: 13px;
}

.gift {
  right: 26px;
  display: grid;
  place-items: center;
  color: #f8fff0;
}

.mountain {
  position: absolute;
  bottom: 18px;
  width: 260px;
  height: 54px;
  background: rgba(29, 89, 76, 0.36);
  border-radius: 70% 44% 0 0;
}

.mountain.one {
  left: 18%;
}

.mountain.two {
  left: 39%;
  height: 66px;
  background: rgba(22, 77, 70, 0.42);
}

.mountain.three {
  right: 15%;
}

.terrace {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 2px;
  z-index: 2;
  background: rgba(235, 255, 206, 0.58);
  box-shadow: 0 7px 0 rgba(235, 255, 206, 0.36), 0 14px 0 rgba(235, 255, 206, 0.25);
}

.terrace-one {
  bottom: 30px;
  transform: rotate(-1deg);
}

.terrace-two {
  bottom: 37px;
  left: 28%;
  right: 27%;
  transform: rotate(1.2deg);
}

.table {
  height: calc(100vh - 106px);
  height: calc(var(--mobile-viewport-height, 100dvh) - 106px);
  min-height: 390px;
  position: relative;
  overflow: visible;
  border-radius: 0 0 26px 26px;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 235, 174, 0.07), transparent 35%),
    linear-gradient(180deg, rgba(13, 48, 38, 0.06), rgba(7, 30, 25, 0.2));
  border: 0;
  box-shadow:
    inset 0 13px 24px rgba(255, 241, 181, 0.08),
    inset 0 -18px 26px rgba(8, 28, 23, 0.18),
    0 10px 28px rgba(3, 16, 16, 0.34);
}

.table-glow {
  position: absolute;
  inset: 22px 120px 78px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 237, 161, 0.09), transparent 68%);
  pointer-events: none;
}

.watermark {
  position: absolute;
  top: 27%;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(102, 70, 37, 0.15);
  font-size: 68px;
  font-weight: 900;
}

.ready-overlay {
  position: absolute;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  background: rgba(57, 29, 13, 0.36);
  backdrop-filter: blur(2px);
}

.ready-overlay.hidden {
  display: none;
}

.ready-panel {
  position: relative;
  z-index: 2;
  width: 430px;
  padding: 25px 30px 30px;
  border-radius: 12px;
  text-align: center;
  background: rgba(97, 53, 26, 0.8);
  border: 2px solid rgba(255, 224, 151, 0.62);
  box-shadow: 0 18px 42px rgba(45, 20, 8, 0.4);
}

.ready-panel.hand-reveal-mode {
  width: min(860px, calc(100% - 32px));
  max-height: calc(100% - 20px);
  padding: 14px 18px 18px;
  overflow-y: auto;
}

.ready-panel.hand-reveal-mode.winner-settlement-mode {
  width: min(1120px, calc(100% - 28px));
}

.ready-panel.hand-reveal-mode .ready-title {
  font-size: 34px;
}

.ready-panel.hand-reveal-mode .ready-subtitle {
  margin: 4px 0 10px;
}

.ready-title {
  color: #ffe48e;
  font-size: 42px;
  font-weight: 900;
  text-shadow: 0 3px 4px rgba(54, 25, 11, 0.55);
}

.ready-subtitle {
  margin: 8px 0 24px;
  color: #fff4cf;
  font-size: 16px;
}

.hand-reveal {
  display: none;
  width: 100%;
  margin: 0 auto 14px;
  text-align: left;
}

.hand-reveal.visible {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hand-reveal.winner-settlement-layout.visible {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.winner-settlement-layout .hand-reveal-player-row.opponent {
  grid-template-columns: 82px minmax(217px, 1fr) 92px;
  min-height: 120px;
  gap: 7px;
  padding: 5px 8px;
}

.winner-settlement-layout .hand-reveal-player-row.winner {
  grid-column: 1 / -1;
  grid-template-columns: 224px minmax(300px, 1fr) 364px;
  min-height: 160px;
  gap: 14px;
  padding: 8px 14px;
}

.winner-settlement-layout .hand-reveal-legend {
  grid-column: 1 / -1;
}

.hand-reveal-player-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 245px minmax(130px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 108px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(48, 25, 13, 0.38);
}

.hand-reveal-player-row.winner {
  background: linear-gradient(90deg, rgba(92, 50, 22, 0.58), rgba(48, 25, 13, 0.4) 42%, rgba(74, 45, 24, 0.52));
  box-shadow: inset 0 0 0 1px rgba(255, 218, 125, 0.2);
}

.hand-reveal-player-label {
  color: #ffe48e;
  font-size: 18px;
  font-weight: 900;
  text-align: left;
  text-shadow: 0 2px 2px rgba(42, 18, 7, 0.5);
}

.hand-reveal-player-columns {
  display: grid;
  grid-template-columns: repeat(7, 31px);
  justify-content: center;
  align-items: start;
  gap: 4px;
  min-width: 0;
}

.settlement-side {
  min-width: 0;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.settlement-side-left {
  align-items: stretch;
  gap: 4px;
}

.settlement-mingtang-side {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  column-gap: 12px;
  align-items: stretch;
  overflow: hidden;
}

.settlement-player-avatar {
  width: 74px;
  height: 74px;
  justify-self: center;
  align-self: center;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 9px;
  color: #fff7d5;
  background: linear-gradient(145deg, #1f527d, #8ec6dd);
  box-shadow: 0 5px 12px rgba(44, 22, 10, 0.34);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(35, 16, 7, 0.56);
}

.settlement-player-avatar.me {
  background: linear-gradient(145deg, #17745a, #80d9bd);
}

.settlement-player-avatar.down {
  background: linear-gradient(145deg, #76501d, #e9ce73);
}

.settlement-mingtang-board {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: min(100%, 138px);
  height: 138px;
  min-height: 0;
  justify-self: start;
  align-self: center;
  overflow: hidden;
}

.settlement-mingtang-board.count-2 {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.settlement-mingtang-board.count-2::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  z-index: 4;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 221, 132, 0.56), transparent);
  box-shadow: 0 1px 2px rgba(44, 16, 5, 0.52);
}

.settlement-mingtang-effect {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  opacity: 0;
  transform-origin: center;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.settlement-mingtang-effect img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 2px 0 rgba(76, 25, 7, 0.82))
    drop-shadow(0 5px 7px rgba(20, 6, 2, 0.48));
}

.settlement-mingtang-fallback {
  display: grid;
  place-items: center;
  min-width: 92px;
  min-height: 40px;
  padding: 3px 10px;
  color: #ffe37d;
  font-size: 25px;
  font-weight: 950;
  line-height: 1;
  text-shadow:
    0 2px 0 #8e250d,
    0 4px 7px rgba(24, 5, 1, 0.72);
}

.settlement-mingtang-effect.is-active {
  z-index: 30;
  animation: settlementMingTangFly 1140ms cubic-bezier(0.18, 0.78, 0.18, 1) both;
}

.settlement-mingtang-effect.is-settled {
  opacity: 1;
  transform: translate(0, 0) scale(1, 1);
}

@keyframes settlementMingTangFly {
  0% {
    opacity: 0;
    transform: translate(
      var(--settlement-effect-start-x, 250px),
      var(--settlement-effect-start-y, 0)
    ) scale(
      var(--settlement-effect-start-scale-x, 1.7),
      var(--settlement-effect-start-scale-y, 1.7)
    );
    filter: brightness(1.25) saturate(1.2);
  }
  14% {
    opacity: 1;
    transform: translate(
      var(--settlement-effect-start-x, 250px),
      var(--settlement-effect-start-y, 0)
    ) scale(
      calc(var(--settlement-effect-start-scale-x, 1.7) * 1.03),
      calc(var(--settlement-effect-start-scale-y, 1.7) * 1.03)
    );
  }
  52% {
    opacity: 1;
    transform: translate(
      var(--settlement-effect-start-x, 250px),
      var(--settlement-effect-start-y, 0)
    ) scale(
      calc(var(--settlement-effect-start-scale-x, 1.7) * 1.03),
      calc(var(--settlement-effect-start-scale-y, 1.7) * 1.03)
    );
    filter: brightness(1.12) saturate(1.08);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1, 1);
    filter: brightness(1) saturate(1);
  }
}

.settlement-side-left.yellow-settlement-side {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  overflow: hidden;
}

.yellow-settlement-effect {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: min(160px, 92%);
  height: min(92px, 92%);
  margin: auto;
  object-fit: contain;
  pointer-events: none;
}

.yellow-settlement-side .yellow-settlement-effect {
  position: relative;
  inset: auto;
  grid-column: 2;
  width: min(160px, 100%);
  height: min(92px, 100%);
  margin: auto;
}

.yellow-settlement-avatar {
  position: relative;
  grid-column: 1;
  justify-self: center;
  width: 74px;
  height: 74px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 9px;
  color: #fff7d5;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(35, 16, 7, 0.56);
  background: linear-gradient(145deg, #1f527d, #8ec6dd);
  box-shadow: 0 5px 12px rgba(44, 22, 10, 0.34);
  display: grid;
  place-items: center;
}

.yellow-settlement-avatar.me {
  background: linear-gradient(145deg, #17745a, #80d9bd);
}

.yellow-settlement-avatar.down {
  background: linear-gradient(145deg, #76501d, #e9ce73);
}

.settlement-side-right {
  align-items: center;
  gap: 5px;
}

.winner-settlement-meta {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  column-gap: 6px;
}

.winner-settlement-meta .settlement-mini-abacus {
  box-sizing: border-box;
  width: 144px;
  height: 104px;
  padding: 5px 12px 7px;
  flex: 0 0 auto;
}

.winner-settlement-lines {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.winner-settlement-lines .winner-detail-line {
  min-height: 22px;
  padding: 3px 8px;
  text-align: center;
  font-size: 13px;
  line-height: 1.2;
}

.winner-settlement-lines .winner-detail-line.capped {
  color: #ffe06e;
  background: linear-gradient(90deg, rgba(135, 42, 15, 0.74), rgba(91, 29, 11, 0.74));
}

.winner-settlement-lines .winner-detail-line.total {
  color: #fff4bf;
  background: rgba(88, 45, 18, 0.82);
  font-size: 14px;
}

.settlement-one-pot-mark {
  width: 138px;
  height: 88px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateX(8px) scale(0.86);
}

.settlement-one-pot-mark.visible {
  animation: settlementOnePotIn 560ms cubic-bezier(0.16, 0.84, 0.2, 1.12) 180ms both;
}

.settlement-one-pot-mark img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 3px 0 rgba(91, 24, 5, 0.72))
    drop-shadow(0 7px 10px rgba(25, 7, 2, 0.5));
}

@keyframes settlementOnePotIn {
  0% { opacity: 0; transform: translateX(8px) scale(0.86); }
  64% { opacity: 1; transform: translateX(-2px) scale(1.06); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

.river-status {
  min-width: 88px;
  padding: 5px 12px 6px;
  border: 1px solid rgba(255, 225, 145, 0.62);
  border-radius: 6px;
  color: #fff2bd;
  background: linear-gradient(180deg, rgba(126, 76, 36, 0.96), rgba(70, 35, 17, 0.96));
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 2px rgba(45, 18, 7, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 183, 0.3),
    0 4px 9px rgba(35, 13, 5, 0.32);
  opacity: 0;
  transform: translateY(7px) scale(0.82);
  animation: riverStatusPop 720ms cubic-bezier(0.18, 0.82, 0.2, 1.12) forwards;
}

.river-status.winner {
  color: #6a2c0a;
  border-color: #ffe09a;
  background: linear-gradient(180deg, #ffe47e, #e9ad31);
  text-shadow: 0 1px 0 rgba(255, 247, 201, 0.72);
}

.river-status.passed {
  color: #f3ffdd;
  border-color: rgba(191, 229, 132, 0.82);
  background: linear-gradient(180deg, #718b39, #3f5821);
}

.river-status.not-passed {
  color: #ffe5d4;
  border-color: rgba(224, 136, 94, 0.78);
  background: linear-gradient(180deg, #98482f, #642718);
}

@keyframes riverStatusPop {
  0% {
    opacity: 0;
    transform: translateY(7px) scale(0.82);
  }
  52% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.winner-detail-line {
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 5px;
  color: #fff2c2;
  background: rgba(55, 27, 13, 0.52);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-align: left;
  opacity: 0;
  transform: translateX(-7px);
}

.winner-detail-line.visible {
  animation: settlementSideLineIn 360ms ease both;
}

.winner-detail-line.compact {
  font-size: 11px;
}

@keyframes settlementSideLineIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.settlement-mini-abacus {
  width: 126px;
  height: 100px;
  padding: 5px 8px 7px;
  border: 3px solid #8d5333;
  border-radius: 9px;
  background: linear-gradient(180deg, #6b2e1d, #32110c);
  box-shadow:
    inset 0 0 0 3px rgba(205, 139, 76, 0.42),
    inset 0 5px 6px rgba(255, 211, 150, 0.1),
    0 5px 9px rgba(25, 8, 4, 0.4);
  opacity: 0;
  transform: translateX(7px) scale(0.96);
}

.settlement-mini-abacus.visible {
  animation: settlementMiniIn 420ms ease both;
}

@keyframes settlementMiniIn {
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.settlement-mini-title {
  height: 14px;
  color: #ffe08a;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.settlement-mini-rods {
  position: relative;
  height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  border: 1px solid #35120d;
  border-radius: 4px;
  background: linear-gradient(180deg, #14271f, #091713);
  box-shadow: inset 0 5px 8px rgba(0, 0, 0, 0.48);
}

.settlement-mini-rods::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 25px;
  z-index: 5;
  height: 7px;
  background: linear-gradient(180deg, #84452b, #3e150f);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.52);
}

.settlement-mini-digit {
  position: relative;
  width: 24px;
  height: 70px;
}

.settlement-mini-rod {
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: 3px;
  z-index: 1;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7b4318, #efc36b 48%, #79501e);
}

.settlement-mini-bead {
  position: absolute;
  left: 50%;
  z-index: 5;
  width: 22px;
  height: 7px;
  border: 1px solid #365541;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 36% 18%, rgba(255, 255, 255, 0.86), transparent 17%),
    linear-gradient(180deg, #b9d2b4, #75987c 52%, #365842);
  box-shadow: inset 0 -2px 2px rgba(14, 42, 25, 0.4), 0 2px 2px rgba(0, 0, 0, 0.5);
}

.hand-reveal-card-column {
  position: relative;
  width: 29px;
  min-height: 104px;
}

.winner-settlement-layout .winner-settlement-cards {
  grid-template-columns: repeat(7, 36px);
  gap: 5px;
}

.winner-settlement-layout .winner-settlement-cards .hand-reveal-card-column {
  width: 36px;
  min-height: 138px;
}

.winner-settlement-layout .winner-settlement-cards .hand-reveal-card-column.empty::after {
  height: 60px;
}

.winner-settlement-layout .winner-settlement-cards .hand-reveal-card {
  width: 36px;
  height: 62px;
  font-size: 22px;
}

.winner-settlement-layout .winner-settlement-cards .hand-reveal-card > .card-glyph {
  height: 28px;
}

.winner-settlement-layout .winner-settlement-cards .hand-reveal-column-huxi {
  bottom: 3px;
  font-size: 10px;
}

.hand-reveal-column-huxi {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 8;
  transform: translateX(-50%);
  color: #ffe27d;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(48, 20, 5, 0.9);
  white-space: nowrap;
}

.hand-reveal-card-column.empty::after {
  content: "";
  position: absolute;
  inset: 0 1px auto;
  height: 34px;
  border: 1px dashed rgba(255, 229, 164, 0.2);
  border-radius: 3px;
}

.hand-reveal-card {
  position: absolute;
  left: 0;
  display: grid;
  place-items: start center;
  width: 29px;
  height: 36px;
  padding-top: 1px;
  border: 1px solid var(--tile-border);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent 36%),
    var(--tile-paper);
  color: #16130f;
  font-family: var(--tile-font);
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  text-shadow: var(--tile-ink-shadow);
  box-shadow: 0 2px 4px rgba(42, 18, 7, 0.24);
}

.hand-reveal-card.red {
  color: #c6211c;
}

.hand-reveal-card.concealed {
  border-color: #777b77;
  background:
    linear-gradient(180deg, rgba(66, 72, 70, 0.2), rgba(48, 54, 52, 0.25)),
    var(--tile-paper);
  color: #16130f;
  text-shadow: var(--tile-ink-shadow);
}

.hand-reveal-card.concealed.red {
  color: #c6211c;
}

.hand-reveal-card > .card-glyph {
  width: 82%;
  height: 16px;
  margin-top: 1px;
}

.hand-reveal-card.concealed > .card-glyph {
  opacity: 1;
  filter: none;
}

.hand-reveal-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: #f9e7bd;
  font-size: 13px;
  font-weight: 800;
}

.hand-reveal-legend span::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid var(--tile-border);
  border-radius: 2px;
  background: var(--tile-paper);
}

.hand-reveal-legend .concealed-key::before {
  border-color: #454746;
  background: #565956;
}

.settlement-summary {
  display: none !important;
}

.settlement-summary.visible {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settlement-columns {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  min-height: 66px;
  margin-bottom: 5px;
  padding: 5px 6px;
  border-radius: 8px;
  background: rgba(47, 25, 14, 0.38);
}

.settlement-column {
  position: relative;
  width: 26px;
  min-height: 58px;
}

.settlement-card {
  position: relative;
  display: grid;
  place-items: start center;
  width: 24px;
  height: 32px;
  margin-top: -15px;
  padding-top: 1px;
  border: 1px solid var(--tile-border);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent 36%),
    var(--tile-paper);
  color: #16130f;
  font-family: var(--tile-font);
  font-size: 20px;
  font-weight: 950;
  line-height: 0.86;
  text-shadow: var(--tile-ink-shadow);
  box-shadow: 0 2px 4px rgba(42, 18, 7, 0.24);
}

.settlement-card:first-child {
  margin-top: 0;
}

.settlement-card.red {
  color: #c6211c;
}

.settlement-line {
  min-height: 30px;
  padding: 5px 12px 6px;
  border-radius: 8px;
  color: #fff6cf;
  background: rgba(58, 31, 17, 0.48);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 2px 2px rgba(42, 18, 7, 0.55);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
}

.settlement-line.visible {
  animation: settlementLineIn 420ms cubic-bezier(0.19, 0.78, 0.22, 1.1) both;
}

@keyframes settlementLineIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ready-button {
  width: 172px;
  height: 58px;
  border-radius: 29px;
  color: #ffffff;
  background: linear-gradient(180deg, #36d0bb, #0b9e8f);
  font-size: 26px;
  font-weight: 900;
  box-shadow: inset 0 3px 2px rgba(255, 255, 255, 0.45), 0 8px 18px rgba(0, 70, 63, 0.38);
}

.seat {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(67, 43, 27, 0.26);
}

.seat-left {
  top: 34px;
  left: 28px;
}

.seat-right {
  top: 34px;
  right: 28px;
  flex-direction: row-reverse;
}

.my-seat {
  position: absolute;
  left: 18px;
  bottom: 12px;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 196px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(67, 43, 27, 0.22);
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff7d5;
  font-size: 23px;
  font-weight: 900;
  background: linear-gradient(145deg, #1f527d, #8ec6dd);
  border: 2px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 4px 10px rgba(44, 22, 10, 0.25);
}

.avatar-gold {
  background: linear-gradient(145deg, #76501d, #e9ce73);
}

.me-avatar {
  background: linear-gradient(145deg, #17745a, #80d9bd);
}

.seat-info {
  max-width: 168px;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fff7d9;
  text-shadow: 0 2px 3px rgba(64, 29, 12, 0.55);
}

.my-seat .seat-info {
  min-width: 0;
  max-width: 108px;
}

.seat-name,
.seat-score {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-name {
  font-size: 16px;
  font-weight: 800;
}

.seat-score {
  font-size: 15px;
  color: #ffe179;
}

.control-row {
  display: flex;
  gap: 7px;
  width: 100%;
  margin-left: 0;
}

.control-row button {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: #fff0c0;
  color: #5b3517;
  font-weight: 800;
  box-shadow: 0 3px 7px rgba(61, 29, 12, 0.22);
}

.center-zone {
  position: absolute;
  top: -88px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  z-index: 40;
}

.huxi-abacus {
  width: clamp(438px, 45vw, 492px);
  height: 132px;
  padding: 17px 22px 18px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% -15%, rgba(255, 208, 150, 0.34), transparent 44%),
    repeating-linear-gradient(4deg, rgba(255, 222, 184, 0.055) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #8f4c31 0 7%, #602719 24%, #3b120d 78%, #260b08);
  border: 5px solid #8e5537;
  outline: 2px solid #c58a58;
  outline-offset: -8px;
  box-shadow:
    inset 0 3px 1px rgba(255, 222, 170, 0.42),
    inset 0 -8px 10px rgba(25, 6, 4, 0.62),
    inset 0 0 0 10px rgba(48, 14, 9, 0.5),
    0 5px 0 #3c160f,
    0 8px 0 rgba(154, 96, 55, 0.52),
    0 15px 24px rgba(17, 7, 4, 0.48);
  position: relative;
  z-index: 50;
}

.huxi-abacus::before {
  content: "";
  position: absolute;
  inset: 17px 18px 18px;
  z-index: 0;
  border: 3px solid rgba(44, 14, 9, 0.96);
  border-radius: 8px;
  background:
    repeating-linear-gradient(118deg, rgba(188, 217, 180, 0.018) 0 2px, transparent 2px 7px),
    radial-gradient(ellipse at 50% 14%, rgba(100, 155, 111, 0.14), transparent 54%),
    linear-gradient(180deg, #14271f, #091713);
  box-shadow:
    inset 0 11px 17px rgba(0, 0, 0, 0.58),
    inset 0 -3px 5px rgba(83, 126, 91, 0.08),
    0 1px 0 rgba(255, 221, 161, 0.2);
}

.huxi-abacus::after {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  top: 46px;
  z-index: 5;
  height: 12px;
  border: 1px solid #2d0e09;
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 218, 166, 0.3), transparent 30%),
    repeating-linear-gradient(3deg, rgba(255, 224, 187, 0.07) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #82452d, #44160f);
  box-shadow:
    inset 0 -4px 3px rgba(0, 0, 0, 0.5),
    0 3px 5px rgba(0, 0, 0, 0.58),
    0 -1px 0 rgba(232, 168, 104, 0.28);
}

.abacus-corner {
  position: absolute;
  z-index: 12;
  width: 31px;
  height: 31px;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(21, 5, 3, 0.7));
}

.abacus-corner::before {
  content: "";
  position: absolute;
  inset: 5px 2px 2px 5px;
  border-top: 5px solid #a7603d;
  border-left: 4px solid #75402c;
  border-radius: 85% 12% 78% 15%;
  transform: rotate(-10deg);
  box-shadow:
    inset 2px 2px 0 rgba(242, 174, 111, 0.34),
    5px 3px 0 -2px #552014,
    10px 7px 0 -4px #9c5838;
}

.abacus-corner::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 9px;
  height: 9px;
  border: 2px solid #4a130e;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ff8c68, #a51d16 48%, #4c0d0b 78%);
  box-shadow: 0 0 0 1px rgba(210, 139, 82, 0.65), 0 2px 3px rgba(0, 0, 0, 0.66);
}

.abacus-corner.top-left { left: 5px; top: 5px; }
.abacus-corner.top-right { right: 5px; top: 5px; transform: scaleX(-1); }
.abacus-corner.bottom-left { left: 5px; bottom: 5px; transform: scaleY(-1); }
.abacus-corner.bottom-right { right: 5px; bottom: 5px; transform: scale(-1); }

.abacus-player {
  position: relative;
  z-index: auto;
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.abacus-name {
  position: relative;
  z-index: 7;
  min-width: 29px;
  padding: 5px 4px;
  border: 2px solid rgba(180, 115, 61, 0.76);
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 28%, rgba(255, 211, 139, 0.12), transparent 28%),
    linear-gradient(180deg, #6a311e, #35120d);
  color: #ffe38c;
  font-family: "STKaiti", "Kaiti SC", serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 2px rgba(51, 23, 8, 0.62);
  box-shadow:
    inset 0 1px rgba(255, 232, 177, 0.2),
    inset 0 -3px 4px rgba(27, 8, 5, 0.48),
    0 2px 4px rgba(0, 0, 0, 0.46);
}

.abacus-digits {
  display: flex;
  gap: 5px;
}

.abacus-digit {
  position: relative;
  width: 32px;
  height: 104px;
}

.digit-label {
  display: none;
}

.abacus-rod {
  position: absolute;
  left: 50%;
  top: 9px;
  bottom: 10px;
  z-index: 1;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, #70401a, #f3ca73 44%, #9b5b24 78%, #4c2711);
  box-shadow: inset 1px 0 rgba(255, 247, 197, 0.54), 0 0 4px rgba(0, 0, 0, 0.6);
}

.abacus-bead {
  position: absolute;
  left: 50%;
  z-index: 6;
  width: 31px;
  height: 13px;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 36% 18%, rgba(255, 255, 255, 0.92), transparent 16%),
    radial-gradient(ellipse at 50% 8%, rgba(224, 246, 219, 0.5), transparent 45%),
    linear-gradient(180deg, #bad3b5 0 18%, #7da083 49%, #3d6048 82%, #294335);
  border: 1px solid #365541;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.44),
    inset 0 -4px 3px rgba(12, 37, 23, 0.48),
    0 3px 4px rgba(0, 0, 0, 0.6);
  transition: top 360ms cubic-bezier(0.2, 0.82, 0.2, 1), filter 180ms ease, box-shadow 180ms ease;
}

.abacus-bead.is-changing {
  filter: brightness(1.16) saturate(1.08);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.44),
    inset 0 -3px 3px rgba(16, 43, 27, 0.42),
    0 0 7px rgba(210, 240, 195, 0.34),
    0 2px 3px rgba(0, 0, 0, 0.54);
}

.abacus-bead.active {
  filter: brightness(1.06) saturate(1.06);
}

.deck {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 0;
  margin-top: 2px;
}

.deck-pile {
  position: relative;
  width: 112px;
  height: 54px;
}

.wall-count {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 15px;
  color: #fff6cc;
  background: rgba(86, 42, 21, 0.78);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 230, 166, 0.28), 0 2px 5px rgba(45, 20, 8, 0.26);
}

.deck-pile span,
.mini-back {
  position: absolute;
  border-radius: 5px;
  border: 2px solid #fff0d4;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 2px),
    linear-gradient(135deg, #c9353d, #8f1724);
  background-size: 8px 8px, auto;
  box-shadow: 0 3px 7px rgba(68, 35, 14, 0.32);
}

.deck-pile span {
  width: 92px;
  height: 38px;
  left: 8px;
}

.deck-pile span:nth-child(1) {
  top: 12px;
}

.deck-pile span:nth-child(2) {
  top: 7px;
  left: 11px;
}

.deck-pile span:nth-child(3) {
  top: 2px;
  left: 14px;
}

.played-card {
  position: absolute;
  width: 48px;
  height: 132px;
  border: 2px solid var(--tile-border);
  border-radius: 5px;
  background:
    radial-gradient(circle at 28% 18%, rgba(138, 100, 55, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent 34%),
    var(--tile-paper);
  color: #171512;
  font-family: var(--tile-font);
  font-size: 31px;
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: 0;
  -webkit-text-stroke: 0.12px currentColor;
  text-shadow: var(--tile-ink-shadow);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 9px rgba(67, 35, 15, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 11;
}

.fly-card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 70;
  width: 48px;
  height: 132px;
  border: 2px solid var(--tile-border);
  border-radius: 5px;
  background:
    radial-gradient(circle at 28% 18%, rgba(138, 100, 55, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent 34%),
    var(--tile-paper);
  color: #171512;
  font-family: var(--tile-font);
  font-size: 31px;
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: 0;
  -webkit-text-stroke: 0.12px currentColor;
  text-shadow: var(--tile-ink-shadow);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 7px 14px rgba(67, 35, 15, 0.34);
  transform: translate(-999px, -999px) scale(0.82);
  transition:
    transform 520ms cubic-bezier(0.2, 0.7, 0.18, 1),
    opacity 140ms ease;
}

.fly-card.visible {
  opacity: 1;
}

.fly-card.red {
  color: #c6211c;
}

.fly-card.back {
  border-color: #fff0d4;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 2px),
    linear-gradient(135deg, #c9353d, #8f1724);
  background-size: 8px 8px, auto;
}

.action-cue {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 75;
  min-width: 0;
  padding: 0;
  color: #f7cb48;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  font-size: 62px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 1.5px #873215;
  text-shadow:
    2px 3px 0 #a24316,
    -1px -1px 0 rgba(255, 248, 190, 0.8),
    0 6px 12px rgba(95, 31, 10, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.62);
}

.action-cue-label {
  display: block;
}

.action-cue.image-cue {
  width: clamp(250px, 25vw, 410px);
  height: auto;
  overflow: visible;
  opacity: 0;
  transform: translate(-50%, -50%);
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.action-cue.image-cue[data-action="peng"] {
  width: clamp(250px, 23vw, 380px);
}

.action-cue.image-cue[data-action="zhao"],
.action-cue.image-cue[data-action="faceOpenOther"],
.action-cue.image-cue[data-action="faceOpenSelf"] {
  width: clamp(265px, 25vw, 410px);
}

.action-cue.image-cue[data-action="chi"] {
  width: clamp(270px, 26vw, 430px);
}

.action-cue.image-cue[data-action="shaoSmall"] {
  width: clamp(245px, 23vw, 365px);
}

.action-cue.image-cue[data-action="shaoBig"] {
  width: clamp(280px, 27vw, 440px);
}

.action-cue.image-cue[data-action="hu"] {
  width: clamp(190px, 18vw, 290px);
}

.action-cue.image-cue.visible {
  opacity: 1;
  animation: none;
}

.action-cue-image {
  display: none;
  width: 100%;
  height: auto;
  opacity: 1;
  object-fit: contain;
  mix-blend-mode: normal;
  filter:
    saturate(1.06)
    contrast(1.04)
    drop-shadow(0 4px 2px rgba(50, 8, 2, 0.68))
    drop-shadow(0 11px 18px rgba(24, 5, 1, 0.48));
  pointer-events: none;
}

.action-cue.image-cue .action-cue-image {
  display: block;
}

.action-cue.video-cue {
  width: clamp(260px, 28vw, 390px);
  aspect-ratio: 16 / 9;
  height: auto;
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, -50%);
  mix-blend-mode: normal;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.action-cue.video-cue.visible {
  opacity: 1;
  animation: none;
}

.action-cue-video {
  position: absolute;
  left: 50%;
  top: 50%;
  display: none;
  width: 100%;
  max-width: none;
  height: auto;
  transform: translate(-50%, -50%) scale(1.08);
  transform-origin: center;
  mix-blend-mode: normal;
  filter: saturate(1.1) contrast(1.06) drop-shadow(0 10px 18px rgba(38, 7, 0, 0.38));
  pointer-events: none;
}

.action-cue.video-cue .action-cue-video {
  display: block;
}

.action-cue.visible {
  animation: actionCuePop 1500ms ease both;
}

.action-cue.round-cue {
  min-width: 250px;
  white-space: nowrap;
  color: #ffd85a;
  font-size: 54px;
  letter-spacing: 0;
  -webkit-text-stroke: 2px #7e240d;
  text-shadow:
    3px 4px 0 #a63c12,
    -1px -1px 0 #fff1a8,
    0 8px 18px rgba(82, 22, 5, 0.58);
}

.action-cue.round-cue.visible {
  animation: onePotCuePop 1600ms cubic-bezier(0.18, 0.82, 0.2, 1) both;
}

.one-pot-celebration,
.red-dou-celebration {
  position: absolute;
  inset: 0;
  z-index: 175;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.one-pot-celebration.visible,
.red-dou-celebration.visible {
  opacity: 1;
  visibility: visible;
}

.one-pot-celebration img {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: min(82%, 980px);
  height: auto;
  opacity: 1;
  mix-blend-mode: normal;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  filter:
    drop-shadow(0 5px 0 rgba(101, 26, 5, 0.64))
    drop-shadow(0 18px 28px rgba(30, 7, 1, 0.52));
  will-change: transform, opacity;
}

.red-dou-celebration img {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: min(92%, 1120px);
  height: auto;
  object-fit: contain;
  opacity: 1;
  mix-blend-mode: normal;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  filter:
    drop-shadow(0 5px 0 rgba(104, 24, 5, 0.68))
    drop-shadow(0 20px 32px rgba(27, 5, 1, 0.58));
  will-change: transform, opacity;
}

.one-pot-celebration.at-avatar img {
  filter:
    drop-shadow(0 2px 0 rgba(101, 26, 5, 0.64))
    drop-shadow(0 6px 10px rgba(30, 7, 1, 0.5));
}

.red-dou-celebration.at-avatar img {
  filter: drop-shadow(0 5px 10px rgba(30, 5, 1, 0.48));
}

.score-reward {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 150;
  width: min(390px, calc(100% - 48px));
  padding: 19px 24px 21px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 222, 118, 0.82);
  border-radius: 10px;
  background: rgba(94, 42, 18, 0.94);
  text-align: center;
  box-shadow:
    inset 0 2px 0 rgba(255, 243, 178, 0.32),
    0 15px 30px rgba(54, 21, 7, 0.4);
  pointer-events: none;
  animation: scoreRewardIn 260ms cubic-bezier(0.18, 0.8, 0.2, 1.1) both;
}

.score-reward.hidden {
  display: none;
}

.score-reward-title {
  color: #ffd85d;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  font-size: 30px;
  font-weight: 950;
  text-shadow: 0 3px 3px rgba(74, 25, 7, 0.72);
}

.score-reward-detail {
  margin-top: 9px;
  color: #fff1bd;
  font-size: 18px;
  font-weight: 900;
}

@keyframes scoreRewardIn {
  from { opacity: 0; transform: translate(-50%, -44%) scale(0.88); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes actionCuePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.62);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(0.92);
  }
}

@keyframes onePotCuePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45) rotate(-4deg);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15) rotate(2deg);
  }
  38% {
    transform: translate(-50%, -50%) scale(0.98) rotate(0);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -62%) scale(0.9);
  }
}

.played-card.visible {
  opacity: 1;
}

.played-card.red-text {
  color: #c6211c;
}

.played-glyph-slot {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 42px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.played-glyph-slot.top {
  top: 5px;
}

.played-glyph-slot.bottom {
  bottom: 5px;
  transform: rotate(180deg);
}

.played-glyph-slot > .card-glyph {
  width: 90%;
  height: 90%;
}

.played-card[data-card="S1"] .played-glyph-slot.top {
  top: 0;
}

.played-card[data-card="S1"] .played-glyph-slot.bottom {
  bottom: 0;
}

.played-card[data-card="S1"] .played-glyph-slot > .card-glyph {
  --glyph-y: 0% !important;
}

.deal-line {
  padding: 5px 16px;
  border-radius: 18px;
  color: #f6d37d;
  background: rgba(91, 58, 31, 0.48);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(63, 31, 13, 0.18);
}

.deal-line {
  color: #fff4cf;
}

.left-played {
  left: 236px;
  top: 39px;
}

.right-played {
  right: 236px;
  top: 37px;
}

.my-played {
  left: calc(50% + 285px);
  bottom: 194px;
}

.tangzi {
  --tangzi-card-size: 24px;
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 2px;
  width: 300px;
  min-width: 0;
  min-height: 28px;
  max-width: 300px;
  max-height: 58px;
  overflow: hidden;
  pointer-events: none;
}

.left-tangzi {
  left: calc(50% - 379px);
  top: 64px;
  width: 270px;
  max-width: 270px;
}

.right-tangzi {
  left: calc(50% + 130px);
  top: 58px;
  width: 270px;
  max-width: 270px;
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.my-tangzi {
  left: calc(50% + 341px);
  right: auto;
  bottom: 286px;
}

.tangzi-card {
  width: var(--tangzi-card-size);
  height: var(--tangzi-card-size);
  border: 1px solid var(--tile-border);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 34%),
    var(--tile-paper);
  color: #151310;
  font-family: var(--tile-font);
  font-size: max(9px, calc(var(--tangzi-card-size) * 0.75));
  font-weight: 950;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 4px rgba(69, 35, 14, 0.2);
}

.tangzi-card.red {
  color: #c6211c;
}

.tangzi-card > .card-glyph {
  width: 84%;
  height: 84%;
}

.hand-huxi-badge {
  position: absolute;
  z-index: 12;
  display: none;
  color: #ffd84f;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(102, 58, 17, 0.95),
    0 0 5px rgba(255, 244, 142, 0.5);
  pointer-events: none;
}

.hand-huxi-badge.visible {
  display: block;
}

.left-hand-huxi {
  left: 124px;
  top: 184px;
}

.right-hand-huxi {
  right: 124px;
  top: 184px;
}

.my-hand-huxi {
  left: 214px;
  bottom: 252px;
}

.side-melds,
.my-melds {
  position: absolute;
  display: flex;
  gap: 1px;
  z-index: 5;
}

.left-melds {
  left: 41px;
  top: 112px;
  width: 230px;
  max-height: 148px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
}

.right-melds {
  right: 42px;
  top: 109px;
  width: 230px;
  max-height: 148px;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
}

.my-melds {
  left: 180px;
  right: auto;
  bottom: 92px;
  width: 250px;
  max-height: 148px;
  flex-wrap: wrap;
  flex-direction: row;
  align-content: flex-start;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
}

.meld {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  color: #2b241b;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.mini-meld-groups {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 1px;
}

.mini-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.mini-meld-cards {
  position: relative;
  width: 30px;
  height: var(--mini-height, 90px);
}

.mini-face {
  position: absolute;
  left: 0;
  top: var(--mini-top, 0);
  z-index: 1;
  width: 28px;
  height: 42px;
  padding-top: 1px;
  border: 1px solid var(--tile-border);
  border-radius: 3px;
  background:
    radial-gradient(circle at 24% 18%, rgba(132, 91, 49, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent 36%),
    var(--tile-paper);
  color: #151310;
  font-family: var(--tile-font);
  display: grid;
  align-items: start;
  justify-items: center;
  font-size: 20px;
  font-weight: 950;
  line-height: 0.8;
  letter-spacing: 0;
  -webkit-text-stroke: 0.1px currentColor;
  text-shadow: var(--tile-ink-shadow);
  box-shadow: 0 2px 4px rgba(73, 35, 15, 0.22);
}

.mini-face.red {
  color: #c6211c;
}

.mini-face > .card-glyph {
  width: 84%;
  height: 19px;
  margin-top: 1px;
}

.my-melds .mini-face {
  width: 28px;
  height: 42px;
  font-size: 19px;
}

.side-melds .table-meld {
  min-width: 30px;
}

.side-melds .mini-face,
.my-melds .mini-face {
  width: 28px;
  height: 42px;
  font-size: 20px;
}

.side-melds .small-shao-stack {
  transform: scale(0.92);
  transform-origin: center top;
}

.my-melds .small-shao-stack {
  transform: scale(0.96);
  transform-origin: left top;
}

.shao-meld {
  min-width: 30px;
}

.chuan-dou-meld {
  min-width: 30px;
  justify-content: flex-start;
}

.small-shao-stack,
.back-stack,
.chuan-dou-stack {
  position: relative;
  width: 30px;
  height: 56px;
}

.chuan-dou-stack {
  height: 82px;
}

.chuan-dou-stack.covered {
  height: 66px;
}

.mini-back {
  width: 27px;
  height: 42px;
}

.mini-back.one {
  left: 0;
  top: 0;
  transform: none;
}

.mini-back.two {
  left: 0;
  top: 7px;
}

.mini-back.three {
  left: 0;
  top: 14px;
  transform: none;
}

.chuan-face {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}

.chuan-back {
  left: 0;
  z-index: 4;
}

.chuan-dou-stack:not(.covered) .chuan-back.b1 {
  top: 24px;
}

.chuan-dou-stack:not(.covered) .chuan-back.b2 {
  top: 32px;
}

.chuan-dou-stack:not(.covered) .chuan-back.b3 {
  top: 40px;
}

.chuan-dou-stack.covered .chuan-back.b1 {
  top: 0;
}

.chuan-dou-stack.covered .chuan-back.b2 {
  top: 8px;
}

.chuan-dou-stack.covered .chuan-back.b3 {
  top: 16px;
}

.chuan-dou-stack.covered .chuan-back.b4 {
  top: 24px;
}

.shao-label {
  color: #ffe27d;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 2px 2px rgba(66, 31, 12, 0.65);
  white-space: nowrap;
}

.meld-huxi {
  min-height: 11px;
  color: #ffe27d;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(66, 31, 12, 0.7);
  white-space: nowrap;
}

.chuan-dou-meld > .meld-huxi {
  position: relative;
  z-index: 6;
  display: block;
  margin-top: 1px;
}

.small-meld {
  min-width: 0;
  min-height: 0;
}

.action-stack {
  position: absolute;
  left: calc(50% + 203px);
  right: auto;
  bottom: 64px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 82;
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  pointer-events: none;
  transition: opacity 160ms ease, transform 180ms ease;
}

.action-stack.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ink-button {
  width: 62px;
  height: 62px;
  padding: 0;
  border-radius: 50%;
  color: #ffffff;
  font-size: 27px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 3px 4px rgba(0, 0, 0, 0.35);
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.ink-button[hidden] {
  display: none;
}

.ink-button.choice-visible {
  animation: choiceButtonPop 420ms cubic-bezier(0.18, 0.78, 0.2, 1.18) both;
}

.ink-button span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.ink-button.eat {
  background: linear-gradient(180deg, #28c5b2, #0b8f82);
  box-shadow: inset 0 4px 3px rgba(255, 255, 255, 0.28), 0 0 0 6px rgba(6, 70, 62, 0.2), 0 7px 14px rgba(50, 24, 10, 0.25);
}

.ink-button.over {
  background: linear-gradient(180deg, #aeb86f, #647333);
  box-shadow: inset 0 4px 3px rgba(255, 255, 255, 0.22), 0 0 0 6px rgba(72, 86, 34, 0.18), 0 7px 14px rgba(50, 24, 10, 0.25);
}

.ink-button.hu {
  background: linear-gradient(180deg, #f0c85c, #bd7625);
  box-shadow: inset 0 4px 3px rgba(255, 255, 255, 0.28), 0 0 0 6px rgba(114, 65, 12, 0.2), 0 7px 14px rgba(50, 24, 10, 0.25);
}

.ink-button.peng {
  background: linear-gradient(180deg, #6387d9, #2f4f9f);
  box-shadow: inset 0 4px 3px rgba(255, 255, 255, 0.24), 0 0 0 6px rgba(25, 47, 105, 0.18), 0 7px 14px rgba(50, 24, 10, 0.25);
}

.ink-button.pass {
  background: linear-gradient(180deg, #4c535d, #20242a);
  box-shadow: inset 0 4px 3px rgba(255, 255, 255, 0.18), 0 0 0 6px rgba(0, 0, 0, 0.17), 0 7px 14px rgba(50, 24, 10, 0.25);
}

.ink-button:not(:disabled):active {
  transform: translateY(2px) scale(0.98);
}

.ink-button:disabled {
  cursor: default;
  opacity: 0.42;
  filter: grayscale(0.35);
}

@keyframes choiceButtonPop {
  0% {
    opacity: 0;
    transform: translateX(18px) scale(0.7);
  }
  65% {
    opacity: 1;
    transform: translateX(0) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.clock {
  position: absolute;
  left: 150px;
  bottom: 158px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #7e4a2b;
  border: 7px solid #f1c154;
  color: #fff;
  line-height: 56px;
  text-align: center;
  font-size: 33px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(67, 35, 15, 0.32);
}

.hand {
  position: absolute;
  left: 216px;
  right: 174px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  min-height: 206px;
  overflow: visible;
  z-index: 6;
  --card-width: clamp(45px, 4.25vw, 54px);
  --card-height: clamp(108px, 9.2vw, 122px);
  --stack-step: clamp(49px, 4.5vw, 56px);
}

.arrange-hand {
  position: absolute;
  left: calc(50% + 205px);
  right: auto;
  bottom: 18px;
  z-index: 20;
  width: 58px;
  height: 34px;
  border-radius: 8px;
  color: #5b3517;
  background: #fff0c0;
  font-size: 15px;
  font-weight: 900;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 5px 10px rgba(60, 29, 12, 0.24);
}

.arrange-hand:active {
  transform: translateY(1px);
}

.hand-column {
  position: relative;
  width: calc(var(--card-width) + 3px);
  min-height: calc(var(--card-height) + var(--stack-step) * 3 + 8px);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  border-radius: 6px;
  margin-right: clamp(-7px, -0.58vw, -4px);
}

.hand-column-huxi {
  position: absolute;
  left: 50%;
  bottom: -12px;
  z-index: 20;
  transform: translateX(-50%);
  color: #ffe27d;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(48, 20, 5, 0.9);
  white-space: nowrap;
  pointer-events: none;
}

.hand-column.locked-column {
  cursor: not-allowed;
}

.hand-column.drag-over {
  outline: 2px solid rgba(13, 158, 145, 0.55);
  outline-offset: 4px;
}

.card {
  position: relative;
  overflow: hidden;
  width: var(--card-width);
  height: var(--card-height);
  padding: 0;
  flex: 0 0 auto;
  border: 2px solid var(--tile-border);
  border-radius: 5px;
  background:
    radial-gradient(circle at 24% 16%, rgba(139, 95, 47, 0.09), transparent 20%),
    radial-gradient(circle at 72% 78%, rgba(175, 132, 78, 0.06), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent 34%),
    var(--tile-paper);
  color: #151310;
  font-family: var(--tile-font);
  font-size: clamp(34px, 4.12vw, 48px);
  font-weight: 950;
  line-height: 0.78;
  letter-spacing: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: 2px;
  text-align: center;
  -webkit-text-stroke: 0.16px currentColor;
  text-shadow: var(--tile-ink-shadow);
  box-shadow:
    inset 0 0 0 1px rgba(141, 101, 56, 0.12),
    0 4px 8px rgba(72, 34, 13, 0.24);
  touch-action: none;
  user-select: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, filter 150ms ease;
}

.hand-card + .hand-card {
  margin-top: calc(var(--stack-step) - var(--card-height));
}

.hand-card {
  z-index: calc(var(--row) + 1);
}

.hand-card > .card-glyph {
  width: 82%;
  height: calc(var(--stack-step) - 10px);
  margin-top: 2px;
  object-position: center top;
}

.hand-card::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 18px;
  height: 4px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle, rgba(176, 112, 40, 0.8) 2px, transparent 2.4px) 0 0 / 6px 4px repeat-x;
  opacity: 0.75;
}

.card.red {
  color: #c6211c;
}

.card.selected {
  transform: translateY(-12px);
  border-color: #0d9e91;
  box-shadow: 0 9px 16px rgba(0, 83, 74, 0.35);
}

.card.dragging-card {
  opacity: 0.7;
  transform: translateY(-10px) scale(0.98);
  border-color: #0d9e91;
}

.card.locked-card {
  cursor: not-allowed;
  color: #151310;
  background:
    linear-gradient(180deg, rgba(66, 72, 70, 0.2), rgba(48, 54, 52, 0.25)),
    var(--tile-paper);
  border-color: #777b77;
  filter: none;
  box-shadow: inset 0 0 0 1px rgba(26, 29, 28, 0.16), 0 3px 7px rgba(45, 24, 13, 0.24);
}

.card.locked-card.red {
  color: #c6211c;
}

.card.locked-card > .card-glyph {
  opacity: 1;
  filter: none;
}

.card.locked-card.selected {
  transform: none;
  border-color: #5d625e;
}

.tips {
  display: none;
}

.chi-picker {
  position: absolute;
  left: 50%;
  bottom: 253px;
  z-index: 145;
  display: none;
  min-width: 108px;
  padding: 10px 14px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(106, 53, 22, 0.62);
  border-radius: 8px;
  background: rgba(82, 43, 21, 0.78);
  box-shadow: 0 8px 18px rgba(62, 27, 10, 0.28);
}

.chi-picker.visible {
  display: block;
  animation: chiPickerIn 180ms ease both;
}

.chi-picker::before {
  content: attr(data-stage);
  display: block;
  margin-bottom: 5px;
  color: #ffe490;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 2px rgba(71, 30, 11, 0.75);
}

@keyframes chiPickerIn {
  from { opacity: 0; transform: translate(-50%, 8px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.chi-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  max-width: 400px;
  pointer-events: auto;
}

.chi-option {
  border: 0;
  pointer-events: auto;
}

.chi-group-option {
  position: relative;
  width: 38px;
  height: 97px;
  padding: 0;
  overflow: visible;
  background: transparent;
  transition: transform 130ms ease, filter 130ms ease;
}

.chi-column-huxi {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  color: #ffe27d;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(48, 20, 5, 0.9);
  white-space: nowrap;
}

.chi-group-option:hover,
.chi-group-option:active {
  transform: translateY(-5px) scale(1.05);
  filter: drop-shadow(0 4px 5px rgba(255, 218, 109, 0.45));
}

.chi-group-stack {
  position: relative;
  display: block;
  width: 34px;
  height: 84px;
}

.chi-group-face {
  width: 34px;
  height: 46px;
  font-size: 23px;
  line-height: 0.78;
  box-shadow: 0 2px 4px rgba(34, 15, 6, 0.34);
}

.chi-group-face > .card-glyph {
  width: 84%;
  height: 17px;
  margin-top: 1px;
}

.log {
  position: absolute;
  left: 50%;
  top: 176px;
  transform: translateX(-50%);
  width: 420px;
  height: 82px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(77, 45, 24, 0.28);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  color: #fff2c0;
  font-size: 14px;
  font-weight: 700;
  z-index: 3;
}

@media (max-width: 1050px) {
  .left-melds {
    left: 41px;
    top: 112px;
    width: 230px;
  }

  .right-melds {
    right: 42px;
    top: 109px;
    width: 230px;
  }

  .hand {
    left: 214px;
  }

  .tips {
    left: 26px;
    bottom: 76px;
  }

  .my-melds {
    left: 166px;
    right: auto;
    width: 210px;
  }

  .action-stack {
    left: auto;
    right: 42px;
  }
}

/* Confirmed in the layout tuner at 1191 x 717 (official layout baseline 2). */
@media (min-width: 1051px) {
  .seat-left {
    top: 51px;
  }

  .left-played {
    left: 221px;
    top: 26px;
  }

  .left-melds {
    left: 33px;
    top: 130px;
  }

  .left-tangzi {
    left: calc(50% - 293px);
    top: 58px;
    width: 162px;
    height: 56px;
    max-width: 162px;
    max-height: 56px;
  }

  .seat-right {
    top: 46px;
  }

  .right-played {
    right: 225px;
    top: 22px;
  }

  .right-melds {
    right: 36px;
    top: 125px;
  }

  .right-tangzi {
    left: calc(50% + 130px);
    top: 58px;
    width: 162px;
    height: 56px;
    max-width: 162px;
    max-height: 56px;
  }

  .my-played {
    left: calc(50% + 280px);
    bottom: 210px;
  }

  .my-tangzi {
    bottom: 288px;
    width: 162px;
    height: 56px;
    max-width: 162px;
    max-height: 56px;
  }
}

@media (orientation: portrait) {
  html:not([data-game-mode="online"]) body::before,
  html[data-game-mode="online"][data-online-board-state="playing"] body::before,
  html[data-game-mode="online"][data-online-board-state="reconnecting"] body::before {
    content: "请横屏试玩";
    position: fixed;
    inset: 0;
    z-index: 220;
    display: grid;
    place-items: center;
    background: #10282b;
    color: #fff1c4;
    font-size: 28px;
    font-weight: 900;
  }
}
