:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-soft: #f8f6f0;
  --ink: #202124;
  --muted: #6f746f;
  --line: #dedbd2;
  --brand: #146c5f;
  --brand-dark: #0d4039;
  --accent: #c9822b;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(32, 33, 36, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

body.popout-page {
  min-width: 360px;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.game-section {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.section-head {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.section-head,
.game-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.section-head {
  padding: 20px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(24px, 3vw, 34px);
}

.section-copy,
.panel-head p,
.muted,
.game-tab small {
  color: var(--muted);
}

.section-copy {
  max-width: 700px;
  margin-bottom: 0;
  line-height: 1.7;
}

.connection-box {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.connection-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.room-actions button {
  padding: 8px 11px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.game-section.compact-mode {
  width: min(100vw - 8px, 760px);
  padding: 6px 0 10px;
}

.game-section.compact-mode .section-head {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.game-section.compact-mode .section-kicker,
.game-section.compact-mode .section-copy,
.game-section.compact-mode .panel-head p,
.game-section.compact-mode .game-tab small {
  display: none;
}

.game-section.compact-mode h1 {
  margin: 0;
  font-size: 22px;
}

.game-section.compact-mode h2 {
  margin: 0;
  font-size: 20px;
}

.game-section.compact-mode .connection-box,
.game-section.compact-mode .game-stage {
  padding: 8px;
}

.game-section.compact-mode .connection-row {
  grid-template-columns: 1fr 1fr auto;
}

.game-section.compact-mode .game-shell {
  grid-template-columns: 1fr;
}

.game-section.compact-mode .game-menu {
  grid-template-columns: repeat(3, 1fr);
  border-right: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px;
}

.game-section.compact-mode .game-tab {
  grid-template-columns: 1fr;
  place-items: center;
  text-align: center;
  padding: 8px 6px;
}

.game-section.compact-mode .game-icon {
  width: 30px;
  height: 30px;
}

.game-section.compact-mode .panel-head {
  align-items: center;
  margin-bottom: 8px;
}

.game-section.compact-mode .status-pill {
  min-height: 28px;
  max-width: 52vw;
  padding: 5px 9px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.game-section.compact-mode .wood {
  padding: 6px;
}

.game-section.compact-mode #gomoku-board {
  width: min(100%, max(260px, calc(100svh - 245px)), 600px);
}

.game-section.compact-mode #draw-board {
  width: min(100%, max(300px, calc((100svh - 285px) * 1.65)), 760px);
}

.game-section.compact-mode .inline-tools,
.game-section.compact-mode .score-strip,
.game-section.compact-mode .guess-box {
  gap: 6px;
  margin: 6px 0;
  padding: 7px;
}

.game-section.compact-mode .inline-tools button,
.game-section.compact-mode .choice,
.game-section.compact-mode .ddz-actions button,
.game-section.compact-mode .chat-input-row button {
  padding: 8px 10px;
  font-size: 13px;
}

.game-section.compact-mode .ddz-players {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.game-section.compact-mode .player-card {
  min-height: 58px;
  padding: 7px;
  font-size: 12px;
}

.game-section.compact-mode .ddz-center {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}

.game-section.compact-mode #ddz-multiplier {
  grid-column: 1 / -1;
  justify-self: start;
}

.game-section.compact-mode .card-row {
  gap: 4px;
  min-height: 42px;
}

.game-section.compact-mode .card {
  width: 34px;
  height: 48px;
  border-radius: 7px;
  font-size: 12px;
}

.game-section.compact-mode .compact .card {
  width: 30px;
  height: 42px;
  font-size: 11px;
}

.game-section.compact-mode .hand {
  max-height: 168px;
  overflow: auto;
  padding: 8px;
}

.game-section.compact-mode .history {
  max-height: 54px;
  overflow: auto;
  margin-top: 6px;
  font-size: 12px;
}

.game-section.compact-mode .chat-panel {
  margin-top: 8px;
  padding-top: 8px;
}

.game-section.compact-mode .chat-log {
  height: 58px;
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 108, 95, 0.12);
}

.connection-status {
  min-height: 20px;
  margin: 0;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.primary,
.chat-input-row button,
.game-tab.active {
  background: var(--brand);
  color: #fff;
}

.primary,
.choice,
.inline-tools button,
.ddz-actions button,
.chat-input-row button,
.game-tab {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
}

.danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.game-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  overflow: hidden;
}

.game-menu {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  background: #f0eee7;
  border-right: 1px solid var(--line);
}

.game-tab {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.game-tab:not(.active):hover {
  background: rgba(20, 108, 95, 0.08);
}

.game-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  font-weight: 900;
}

.game-tab.active .game-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.game-tab strong,
.game-tab small {
  display: block;
}

.game-stage {
  min-width: 0;
  padding: 16px;
}

.game-panel {
  display: none;
}

.game-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head p {
  margin-bottom: 0;
  line-height: 1.6;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #edf7f4;
  border: 1px solid #cce2dc;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.board-frame {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.board-frame canvas {
  display: block;
  width: 100%;
  max-width: 760px;
  touch-action: none;
}

.wood {
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(86, 52, 22, 0.08) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(#dba65f, #c98739);
}

.paper {
  padding: 10px;
  background: #fff;
}

.inline-tools,
.score-strip,
.guess-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.score-strip {
  justify-content: space-between;
}

.choice,
.inline-tools button,
.ddz-actions button {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-dark);
}

.hidden {
  display: none !important;
}

.ddz-table {
  display: grid;
  gap: 12px;
}

.ddz-players {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.player-card {
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.player-card.active {
  outline: 3px solid rgba(20, 108, 95, 0.16);
}

.player-card strong {
  display: block;
  margin-bottom: 6px;
}

.ddz-center {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #edf4ef;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 54px;
  align-items: center;
}

.card {
  display: grid;
  place-items: center;
  width: 50px;
  height: 70px;
  border: 1px solid rgba(32, 33, 36, 0.2);
  border-radius: 10px;
  background: linear-gradient(160deg, #fff, #f6f1e8);
  box-shadow: 0 8px 18px rgba(32, 33, 36, 0.1);
  font-weight: 900;
  user-select: none;
}

.card.red {
  color: var(--danger);
}

.compact .card {
  width: 42px;
  height: 56px;
  font-size: 13px;
}

.hand {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.hand .card {
  cursor: pointer;
}

.hand .card.selected {
  transform: translateY(-14px);
  background: linear-gradient(160deg, #fff8d7, #e6bd4a);
  border-color: var(--accent);
}

.ddz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.chat-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-log {
  height: 132px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  line-height: 1.7;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .section-head,
  .game-shell,
  .ddz-center {
    grid-template-columns: 1fr;
  }

  .game-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .game-tab {
    grid-template-columns: 1fr;
    text-align: center;
    place-items: center;
  }

  .game-tab small {
    display: none;
  }

  .ddz-players {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px), (max-height: 680px) {
  body {
    overflow-x: hidden;
  }

  .game-section {
    width: min(100vw - 8px, 760px);
    padding: 6px 0 10px;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    margin-bottom: 8px;
  }

  .section-kicker,
  .section-copy,
  .panel-head p,
  .game-tab small {
    display: none;
  }

  h1 {
    margin: 0;
    font-size: 22px;
  }

  h2 {
    margin: 0;
    font-size: 20px;
  }

  .connection-box,
  .game-stage {
    padding: 8px;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .game-menu {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: repeat(3, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 6px;
  }

  .game-tab {
    grid-template-columns: 1fr;
    place-items: center;
    text-align: center;
    padding: 8px 6px;
  }

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

  .panel-head {
    align-items: center;
    margin-bottom: 8px;
  }

  .status-pill {
    min-height: 28px;
    max-width: 52vw;
    padding: 5px 9px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  .wood {
    padding: 6px;
  }

  #gomoku-board {
    width: min(100%, max(260px, calc(100svh - 245px)), 600px);
  }

  #draw-board {
    width: min(100%, max(300px, calc((100svh - 285px) * 1.65)), 760px);
  }

  .inline-tools,
  .score-strip,
  .guess-box {
    gap: 6px;
    margin: 6px 0;
    padding: 7px;
  }

  .ddz-players {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .player-card {
    min-height: 58px;
    padding: 7px;
    font-size: 12px;
  }

  .ddz-center {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }

  #ddz-multiplier {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .card-row {
    gap: 4px;
    min-height: 42px;
  }

  .card {
    width: 34px;
    height: 48px;
    border-radius: 7px;
    font-size: 12px;
  }

  .compact .card {
    width: 30px;
    height: 42px;
    font-size: 11px;
  }

  .hand {
    max-height: 168px;
    overflow: auto;
    padding: 8px;
  }

  .history {
    max-height: 54px;
    overflow: auto;
    margin-top: 6px;
    font-size: 12px;
  }

  .chat-panel {
    margin-top: 8px;
    padding-top: 8px;
  }

  .chat-log {
    height: 58px;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .game-section {
    width: min(100vw - 12px, 1180px);
    padding-top: 8px;
  }

  .section-head,
  .game-stage {
    padding: 12px;
  }

  .connection-row,
  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .game-menu {
    gap: 6px;
    padding: 8px;
  }

  .card {
    width: 32px;
    height: 46px;
    border-radius: 7px;
    font-size: 11px;
  }

  .compact .card {
    width: 28px;
    height: 40px;
    font-size: 10px;
  }

  .hand {
    max-height: 146px;
  }
}

@media (max-width: 420px) {
  .section-head {
    padding: 8px;
  }

  .connection-box {
    gap: 7px;
  }

  .room-actions button,
  .primary,
  .choice,
  .inline-tools button,
  .ddz-actions button,
  .chat-input-row button {
    padding: 7px 9px;
    font-size: 12px;
  }

  input {
    padding: 8px 9px;
    font-size: 13px;
  }

  .status-pill {
    max-width: 46vw;
  }

  #gomoku-board {
    width: min(100%, max(230px, calc(100svh - 230px)), 600px);
  }

  #draw-board {
    width: min(100%, max(270px, calc((100svh - 265px) * 1.65)), 760px);
  }

  .chat-log {
    height: 46px;
  }
}

/* 斗地主：按经典欢乐斗地主的牌桌观感重做，使用纯 CSS，不依赖第三方素材。 */
#panel-doudizhu {
  --ddz-green: #0b6b4b;
  --ddz-green-deep: #074733;
  --ddz-gold: #f3c35b;
  --ddz-gold-deep: #b9791d;
}

#panel-doudizhu .panel-head {
  margin-bottom: 10px;
}

#panel-doudizhu .ddz-table {
  position: relative;
  gap: 12px;
  padding: 14px;
  border: 2px solid rgba(243, 195, 91, 0.75);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 34%),
    linear-gradient(145deg, #0b7a53, #06412f 68%, #03281f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 18px 36px rgba(0, 0, 0, 0.18);
}

#panel-doudizhu .ddz-players {
  gap: 8px;
}

#panel-doudizhu .player-card {
  position: relative;
  min-height: 82px;
  padding: 12px 12px 10px 54px;
  overflow: hidden;
  border: 1px solid rgba(243, 195, 91, 0.5);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(6, 51, 38, 0.9), rgba(12, 105, 74, 0.78));
  color: #fffaf0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

#panel-doudizhu .player-card::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 32px;
  height: 32px;
  border: 2px solid rgba(243, 195, 91, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff3bd, #d9962a 58%, #8c4c12);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

#panel-doudizhu .player-card.active {
  outline: 0;
  border-color: #ffe08a;
  box-shadow: 0 0 0 3px rgba(243, 195, 91, 0.24), 0 0 18px rgba(243, 195, 91, 0.36);
}

#panel-doudizhu .player-card strong {
  margin-bottom: 5px;
  color: #fff7d4;
  font-size: 15px;
}

#panel-doudizhu .player-card .muted,
#panel-doudizhu .ddz-center .muted {
  color: rgba(255, 255, 255, 0.76);
}

#panel-doudizhu .player-card .status-pill {
  min-height: 24px;
  margin-top: 6px;
  padding: 3px 8px;
  border-color: rgba(243, 195, 91, 0.55);
  background: rgba(255, 246, 204, 0.14);
  color: #fff7d4;
}

#panel-doudizhu .ddz-center {
  grid-template-columns: minmax(120px, 0.9fr) minmax(160px, 1.2fr) auto;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(2, 37, 28, 0.58);
}

#panel-doudizhu #ddz-multiplier {
  border-color: rgba(243, 195, 91, 0.72);
  background: linear-gradient(180deg, #fff0a8, #e5a936);
  color: #5a3200;
}

#panel-doudizhu .ddz-actions {
  justify-content: center;
  min-height: 42px;
}

#panel-doudizhu .ddz-actions button {
  min-width: 74px;
  border: 1px solid rgba(255, 237, 172, 0.9);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0a8, #e19a2e);
  color: #5a3200;
  box-shadow: 0 6px 0 #8b5417, 0 10px 18px rgba(0, 0, 0, 0.22);
}

#panel-doudizhu .ddz-actions button.primary {
  background: linear-gradient(180deg, #fff4b8, #f0b33f);
}

#panel-doudizhu .ddz-actions button:disabled {
  opacity: 0.45;
  box-shadow: none;
}

#panel-doudizhu .card-row {
  gap: 4px;
}

#panel-doudizhu .card {
  width: 46px;
  height: 64px;
  border: 1px solid rgba(23, 23, 23, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(145deg, #ffffff 0%, #fffdf6 56%, #eadfc6 100%);
  box-shadow: 0 7px 12px rgba(0, 0, 0, 0.24);
  color: #111827;
  font-size: 14px;
}

#panel-doudizhu .card.red {
  color: #c1121f;
}

#panel-doudizhu .compact .card {
  width: 34px;
  height: 48px;
  font-size: 12px;
}

#panel-doudizhu .hand {
  min-height: 104px;
  padding: 18px 22px 14px;
  overflow-x: auto;
  border-color: rgba(243, 195, 91, 0.48);
  background: linear-gradient(180deg, rgba(1, 32, 25, 0.52), rgba(1, 23, 18, 0.76));
}

#panel-doudizhu .hand .card {
  flex: 0 0 auto;
  margin-right: -18px;
  cursor: pointer;
  transform: translateY(calc(var(--card-curve) * 1.4px)) rotate(var(--card-angle));
  transform-origin: 50% 120%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#panel-doudizhu .hand .card:hover {
  transform: translateY(-12px) rotate(var(--card-hover-angle));
}

#panel-doudizhu .hand .card.selected {
  transform: translateY(-24px) rotate(0deg);
  border-color: #f4b740;
  background: linear-gradient(145deg, #fffdf2, #ffe08a);
  box-shadow: 0 0 0 3px rgba(243, 195, 91, 0.34), 0 12px 16px rgba(0, 0, 0, 0.28);
}

#panel-doudizhu + .chat-panel {
  margin-top: 12px;
}

#ddz-history.history {
  max-height: 70px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid rgba(11, 107, 75, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
}

@media (max-width: 760px) {
  #panel-doudizhu .ddz-table {
    padding: 10px;
  }

  #panel-doudizhu .ddz-center {
    grid-template-columns: 1fr 1fr;
  }

  #panel-doudizhu #ddz-multiplier {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #panel-doudizhu .card {
    width: 38px;
    height: 54px;
    font-size: 12px;
  }

  #panel-doudizhu .hand {
    min-height: 92px;
    padding: 16px 18px 12px;
  }
}

@media (max-width: 520px) {
  #panel-doudizhu .ddz-players {
    grid-template-columns: 1fr;
  }

  #panel-doudizhu .player-card {
    min-height: 64px;
    padding: 9px 10px 8px 48px;
  }

  #panel-doudizhu .player-card::before {
    left: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
  }

  #panel-doudizhu .hand .card {
    margin-right: -18px;
  }
}

.uno-table,
.mahjong-table {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.uno-table {
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.16), transparent 34%), #202124;
}

.uno-players,
.mj-players {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.uno-player,
.mj-player {
  min-height: 64px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid transparent;
}

.uno-player.active,
.mj-player.active {
  border-color: #f3c35b;
  box-shadow: 0 0 0 3px rgba(243, 195, 91, 0.2);
}

.uno-player strong,
.mj-player strong {
  display: block;
  margin-bottom: 4px;
}

.uno-player em,
.mj-player em {
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8f7f2;
  color: var(--brand-dark);
  font-style: normal;
  font-weight: 800;
}

.uno-center {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.uno-card-stack {
  min-height: 112px;
  display: flex;
  align-items: center;
}

.uno-card {
  display: grid;
  place-items: center;
  width: 72px;
  height: 104px;
  border: 5px solid #fff;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

.uno-card span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.uno-card.red { background: #d72638; }
.uno-card.yellow { background: #f7b801; color: #3a2400; }
.uno-card.green { background: #1b998b; }
.uno-card.blue { background: #2d7dd2; }
.uno-card.wild,
.uno-card.back {
  background: conic-gradient(#d72638 0 25%, #f7b801 0 50%, #1b998b 0 75%, #2d7dd2 0);
}

.uno-color-chip {
  min-width: 76px;
  padding: 10px 12px;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  text-align: center;
  font-weight: 900;
}

.uno-color-chip[data-color="red"] { background: #d72638; color: #fff; }
.uno-color-chip[data-color="yellow"] { background: #f7b801; color: #3a2400; }
.uno-color-chip[data-color="green"] { background: #1b998b; color: #fff; }
.uno-color-chip[data-color="blue"] { background: #2d7dd2; color: #fff; }

.uno-actions,
.mj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
}

.uno-actions button,
.mj-actions button {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.uno-hand {
  display: flex;
  gap: 0;
  min-height: 126px;
  overflow-x: auto;
  padding: 12px;
}

.uno-hand .uno-card {
  flex: 0 0 auto;
  margin-right: -20px;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.uno-hand .uno-card:hover {
  transform: translateY(-12px);
}

.mahjong-table {
  background: linear-gradient(145deg, #0e6b50, #06382b);
}

.mj-center {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mj-melds,
.mj-hand,
.mj-river {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.mj-meld {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
}

.mj-tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 52px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: linear-gradient(180deg, #fffdf4, #e5dcc7);
  color: #123c31;
  font-weight: 900;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.22);
}

.mj-hand .mj-tile {
  cursor: pointer;
}

.mj-hand .mj-tile:hover {
  transform: translateY(-8px);
}

@media (max-width: 760px) {
  .uno-players,
  .mj-players {
    grid-template-columns: repeat(2, 1fr);
  }

  .uno-card {
    width: 58px;
    height: 84px;
    border-width: 4px;
  }

  .mj-tile {
    width: 32px;
    height: 46px;
    font-size: 12px;
  }
}

@media (max-width: 460px) {
  .uno-players,
  .mj-players,
  .uno-center,
  .mj-center {
    grid-template-columns: 1fr;
  }
}
