/* ==========================================================================
   卡牌游戏厅 —— 样式
   目录：基础 / 顶栏 / 主菜单 / 斗地主 / UNO / 弹窗 / 响应式
   ========================================================================== */

:root {
  --felt-1: #12684a;
  --felt-2: #0a3a2a;
  --felt-3: #06231a;
  --gold: #f2c45a;
  --gold-deep: #c99a2e;
  --ink: #14202a;
  --red: #d63b3b;
  --panel: rgba(3, 20, 14, 0.55);
  --panel-line: rgba(242, 196, 90, 0.28);
  --card-w: 76px;
  --card-h: 106px;
  --radius: 14px;
  --shadow-card: 0 3px 8px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .5) inset;
  /* UNO 四色 */
  --uno-r: #d8383a;
  --uno-y: #d8a006;
  --uno-g: #2f9e44;
  --uno-b: #2f6fd0;
  --uno-w: #1d2128;
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(120% 90% at 50% -10%, #1b8360 0%, var(--felt-1) 34%, var(--felt-2) 68%, var(--felt-3) 100%);
  color: #eef6f1;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .014) 0 2px, transparent 2px 6px),
    radial-gradient(60% 45% at 50% 42%, rgba(255, 255, 255, .09), transparent 70%);
}

[hidden] { display: none !important; }

.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------ 屏幕 */

.screen { display: none; }

.screen.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px clamp(10px, 2vw, 26px) 12px;
  min-height: 100vh;
  animation: screen-in .22s ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ 主菜单 */

.screen[data-screen="menu"] {
  justify-content: center;
  align-items: center;
  gap: 26px;
  text-align: center;
}

.menu__head { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.menu__logo {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .5));
  animation: float 3.6s ease-in-out infinite;
}

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

.menu__title {
  margin: 6px 0 0;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: .18em;
  font-weight: 900;
  background: linear-gradient(180deg, #fff6da, var(--gold) 58%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 30px rgba(242, 196, 90, .18);
}

.menu__sub { margin: 0; font-size: 14px; opacity: .66; letter-spacing: .08em; }

.menu__modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 900px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 22px 22px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: linear-gradient(170deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .28));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s ease, border-color .25s, box-shadow .25s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .32);
  backdrop-filter: blur(6px);
}

.mode-card::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px; height: 220px;
  border-radius: 50%;
  opacity: .22;
  filter: blur(28px);
  transition: opacity .25s;
}
.mode-card--ddz::after { background: #f2c45a; }
.mode-card--uno::after { background: #ff6b6b; }

.mode-card:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 196, 90, .5);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.mode-card:hover::after { opacity: .38; }
.mode-card:active { transform: translateY(-1px) scale(.995); }

.mode-card__art {
  display: flex;
  gap: 8px;
  height: 78px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.mode-card__art > span:nth-child(1) { transform: rotate(-9deg) translateY(4px); }
.mode-card__art > span:nth-child(2) { transform: rotate(0deg); z-index: 2; }
.mode-card__art > span:nth-child(3) { transform: rotate(9deg) translateY(4px); }

.mini-face {
  width: 50px; height: 70px;
  border-radius: 7px;
  background: linear-gradient(170deg, #fff, #e6eaee);
  color: #14202a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  font-family: "DIN Alternate", "Arial Black", Impact, system-ui, sans-serif;
}
.mini-face i { font-style: normal; font-size: 15px; align-self: flex-end; }
.mini-face.red { color: var(--red); }

.mini-uno {
  width: 50px; height: 74px;
  border-radius: 8px;
  border: 3px solid #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 19px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.mini-uno.c-red { background: var(--uno-r); }
.mini-uno.c-blue { background: var(--uno-b); }
.mini-uno.c-wild {
  background: conic-gradient(from 45deg, var(--uno-r) 0 25%, var(--uno-y) 0 50%, var(--uno-g) 0 75%, var(--uno-b) 0);
}

.mode-card__body { position: relative; z-index: 1; }
.mode-card__body h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: .1em;
  color: var(--gold);
}
.mode-card__body p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.7; opacity: .82; }

.mode-card__meta { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-card__meta span {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .32);
  border: 1px solid rgba(255, 255, 255, .13);
  opacity: .85;
}

.mode-card__go {
  position: absolute;
  right: 20px; bottom: 18px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .08em;
  z-index: 1;
}

.menu__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-line);
}
.menu__hint { font-size: 12px; opacity: .5; }

/* ------------------------------------------------------------------ 顶栏 */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(6px);
  flex: none;
}

.tool--back { font-weight: 700; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
  letter-spacing: .06em;
}

.brand__icon { font-size: 22px; }

.brand__name {
  font-size: 21px;
  background: linear-gradient(180deg, #fff3cd, var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand--uno .brand__name {
  background: linear-gradient(90deg, #ff7a7a, #ffd166 45%, #6ec1ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand em {
  font-style: normal;
  font-size: 12px;
  opacity: .62;
  letter-spacing: .18em;
}

.scoreboard {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 160px;
  justify-content: center;
  flex-wrap: wrap;
}

.score {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .1);
  font-size: 13px;
  white-space: nowrap;
  transition: border-color .25s, box-shadow .25s;
}

.score.is-you { border-color: rgba(242, 196, 90, .5); }

.score__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6fd3a6;
  box-shadow: 0 0 8px #6fd3a6;
}
.score.is-you .score__dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

.score__name { opacity: .82; }
.score__val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); min-width: 2.2em; text-align: right; }
.score__val.neg { color: #ff8f8f; }

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

.select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: .9;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 3px 4px 3px 11px;
}

.select select {
  background: transparent;
  color: #eef6f1;
  border: 0;
  font: inherit;
  font-size: 13px;
  padding: 3px 4px;
  outline: none;
  cursor: pointer;
}
.select select option { color: #14202a; }
.select select.difficulty-select { font-weight: 700; }

.sound-toggle.is-off { opacity: .5; }

.tool {
  font: inherit;
  font-size: 13px;
  color: #eef6f1;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s;
}
.tool:hover { background: rgba(255, 255, 255, .12); border-color: rgba(242, 196, 90, .45); }
.tool:active { transform: scale(.94); }
.tool.is-off { opacity: .45; }

/* ------------------------------------------------------------------ 牌桌 */

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "left center right";
  gap: 10px;
  align-items: start;
  align-content: center;
  flex: 1 1 auto;
  min-height: 0;
}

.side { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.side--left { grid-area: left; align-items: flex-start; }
.side--right { grid-area: right; align-items: flex-end; }

/* 座位卡 */
.seat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .12);
  transition: border-color .3s, box-shadow .3s, transform .3s;
  min-width: 168px;
}

.seat.is-turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(242, 196, 90, .35), 0 0 22px rgba(242, 196, 90, .3);
  transform: translateY(-2px);
}

.seat.is-landlord .avatar { background: linear-gradient(180deg, #ffd979, var(--gold-deep)); color: #3a2600; }
.seat.is-landlord .seat__role { color: var(--gold); border-color: rgba(242, 196, 90, .5); }

.avatar {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 22px;
  background: rgba(255, 255, 255, .13);
  flex: none;
}

.seat__meta { min-width: 0; flex: 1; }
.seat__name { font-weight: 700; font-size: 15px; }

.seat__role {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  opacity: .86;
}

.seat__count { font-size: 13px; text-align: right; opacity: .9; white-space: nowrap; }
.seat__count b { font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }
.seat__count i { font-style: normal; font-size: 11px; opacity: .7; }

/* 气泡（不要 / 叫分） */
.bubble {
  position: absolute;
  right: -6px;
  bottom: -14px;
  transform: translateY(0);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .68);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #ffd979;
  animation: pop .22s ease-out;
  white-space: nowrap;
  z-index: 5;
}

@keyframes pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 电脑手牌背面 */
.fan {
  display: flex;
  height: 46px;
  align-items: center;
  padding-left: 4px;
}
.side--right .fan { padding-left: 0; padding-right: 4px; flex-direction: row-reverse; }

.fan .back {
  width: 26px; height: 38px;
  border-radius: 5px;
  margin-left: -18px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 3px, transparent 3px 6px),
    linear-gradient(160deg, #1f5f9c, #123a63);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
  flex: none;
}
.fan .back:first-child { margin-left: 0; }
.side--right .fan .back:first-child { margin-left: 0; }

/* 中央 */
.center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  min-width: 0;
}

.bottom {
  position: relative;
  display: flex;
  gap: 6px;
  padding: 26px 10px 10px;
  border-radius: var(--radius);
  border: 1px dashed rgba(242, 196, 90, .35);
  background: rgba(0, 0, 0, .2);
  min-height: 60px;
}
.bottom::before {
  content: "底牌";
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: .3em;
  opacity: .6;
}

.multiplier {
  font-size: 13px;
  padding: 3px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(242, 196, 90, .28);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .04em;
}

.status {
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
  opacity: .95;
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* 出牌区 */
.played {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 62px;
  gap: 0;
  padding: 0 4px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.side--left .played { justify-content: flex-start; }
.side--right .played { justify-content: flex-end; }
.played--mine { min-height: 66px; }

/* ------------------------------------------------------------------ 扑克牌 */

.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  flex: none;
  border-radius: 9px;
  background: linear-gradient(170deg, #ffffff 0%, #f2f4f6 72%, #dfe4e8 100%);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 0, 0, .22);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s;
  will-change: transform;
}

.card .c-rank {
  font-size: var(--fs-rank, 20px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  font-family: "DIN Alternate", "Arial Black", Impact, system-ui, sans-serif;
}

.card .c-suit {
  font-size: var(--fs-suit, 17px);
  line-height: 1;
  align-self: flex-end;
}

.card .c-big {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  font-size: var(--fs-big, 34px);
  line-height: 1;
  opacity: .13;
  pointer-events: none;
}

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

.card.joker .c-rank { font-size: calc(var(--fs-rank, 20px) * 0.72); writing-mode: horizontal-tb; }
.card.joker .c-suit { font-size: calc(var(--fs-suit, 17px) * 1.15); }

.card.is-joker-big { background: linear-gradient(170deg, #fffdf3, #ffe9b8 80%, #f6d089); }

.card--mini {
  width: 46px;
  height: 64px;
  border-radius: 6px;
  padding: 3px 4px;
}
.card--mini .c-rank { font-size: 13px; }
.card--mini .c-suit { font-size: 11px; }
.card--mini .c-big { font-size: 19px; }
.card--mini.joker .c-rank { font-size: 10px; }
.card--mini.joker .c-suit { font-size: 13px; }

.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, #2a6fb0, #123c66);
  border: 1px solid rgba(255, 255, 255, .28);
}
.card.back .c-rank, .card.back .c-suit { display: none; }

/* 手牌区 */
.mine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 0;
  flex: none;
}

.mine__top {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.seat--me { flex: none; }
.seat--me .avatar { background: rgba(255, 255, 255, .18); }

.played--mine { flex: 1; justify-content: center; }

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-height: calc(var(--card-h) + 26px);
  padding: 22px 6px 4px;
}

.hand .card { cursor: pointer; }
.hand .card:not(.is-selected):hover { transform: translateY(-10px); }

.hand .card.is-selected {
  transform: translateY(-22px);
  box-shadow: 0 0 0 2px var(--gold), 0 10px 20px rgba(0, 0, 0, .5);
  z-index: 3;
}

.hand .card.is-hint { box-shadow: 0 0 0 2px #7fd8ff, 0 0 16px rgba(127, 216, 255, .6); }

.hand-hint {
  font-size: 12px;
  opacity: .5;
  letter-spacing: .04em;
  min-height: 16px;
}

/* ------------------------------------------------------------------ 按钮 */

.controls { display: flex; justify-content: center; min-height: 52px; flex: none; }

.ctrl-group { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #eef6f1;
  background: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 12px;
  padding: 11px 30px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, filter .2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

.btn:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn--gold {
  color: #3a2600;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, var(--gold-deep));
  border-color: rgba(255, 255, 255, .5);
  box-shadow: 0 6px 18px rgba(201, 154, 46, .45);
}

.btn--ghost { background: rgba(0, 0, 0, .3); }
.btn--wide { padding: 13px 54px; font-size: 17px; }

/* ------------------------------------------------------------------ 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .82);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #ffd979;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 999px;
  z-index: 60;
  animation: toast-in .2s ease-out;
  pointer-events: none;
  max-width: 88vw;
  text-align: center;
}

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

/* ------------------------------------------------------------------ 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 18px;
  animation: fade .18s ease-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal__box {
  width: min(620px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #10402f, #08281d);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  overflow: hidden;
  animation: rise .22s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal__box h2 {
  margin: 0;
  padding: 16px 22px;
  font-size: 17px;
  letter-spacing: .1em;
  color: var(--gold);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.modal__body { padding: 16px 22px; overflow: auto; font-size: 14px; line-height: 1.75; }
.modal__body p { margin: 0 0 10px; }
.modal__body ul { margin: 0 0 10px; padding-left: 20px; }
.modal__body li { margin-bottom: 3px; }
.modal__body b { color: var(--gold); }

.modal__foot {
  padding: 14px 22px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.modal__box--result { width: min(430px, 100%); }

.result__banner {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .22em;
  text-align: center;
  padding: 26px 10px 6px;
}
.result__banner.win { color: var(--gold); text-shadow: 0 0 26px rgba(242, 196, 90, .55); }
.result__banner.lose { color: #ff9a9a; text-shadow: 0 0 26px rgba(255, 120, 120, .4); }

.result__row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .1);
  font-size: 14px;
}
.result__row:last-child { border-bottom: 0; }
.result__row .v { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.result__row .v.neg { color: #ff9a9a; }

/* ==================================================================== *
 * UNO
 * ==================================================================== */

.uno-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "left center right";
  gap: 10px;
  align-items: start;
  align-content: center;
  flex: 1 1 auto;
  min-height: 0;
}

.uno-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
}

.uno-piles { display: flex; align-items: center; gap: clamp(12px, 3vw, 36px); }

.uno-deckpile {
  position: relative;
  width: 76px; height: 112px;
  border-radius: 11px;
  border: 3px solid #fff;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .12) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #2c2f38, #14161b);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  cursor: pointer;
  color: #fff;
  font: inherit;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .15s, filter .2s;
}
.uno-deckpile:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.18); }
.uno-deckpile:disabled { opacity: .5; cursor: not-allowed; }

.uno-deckpile__logo {
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.05em;
  font-size: 21px;
  color: #ffd166;
  text-shadow: 0 2px 0 #b32020;
  transform: rotate(-16deg);
}

.uno-deckpile__count {
  position: absolute;
  right: -9px; bottom: -9px;
  min-width: 27px; height: 27px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #3a2600;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  border: 2px solid #0a2a1f;
}

.uno-discard {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 76px;
  min-height: 112px;
}
.uno-discard::before {
  content: "";
  position: absolute;
  inset: 7px -7px -7px 7px;
  border-radius: 11px;
  background: rgba(0, 0, 0, .3);
}
.uno-discard .uno-card { position: relative; animation: drop-in .24s ease-out; }

@keyframes drop-in {
  from { transform: translateY(-20px) rotate(-9deg) scale(1.08); opacity: .15; }
  to { transform: none; opacity: 1; }
}

.uno-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.uno-chip {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 13px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #dfe9e3;
  transition: background .25s, border-color .25s, color .25s;
}
.uno-chip.uno-c-R { background: rgba(216, 56, 58, .3); border-color: var(--uno-r); color: #ffb3b3; }
.uno-chip.uno-c-Y { background: rgba(216, 160, 6, .3); border-color: var(--uno-y); color: #ffe08a; }
.uno-chip.uno-c-G { background: rgba(47, 158, 68, .3); border-color: var(--uno-g); color: #a8e6b8; }
.uno-chip.uno-c-B { background: rgba(47, 111, 208, .3); border-color: var(--uno-b); color: #a9ccff; }
.uno-chip--dir { font-variant-numeric: tabular-nums; }

/* ---------------- UNO 牌面 ---------------- */

.uno-card {
  --uno-fs: 15px;
  --uno-fs-oval: 30px;
  position: relative;
  width: 76px;
  height: 112px;
  flex: none;
  border-radius: 11px;
  border: 3px solid #fff;
  background: var(--uno-w);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
  color: #fff;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s;
  will-change: transform;
}

.uno-card.uno-R { background: var(--uno-r); }
.uno-card.uno-Y { background: var(--uno-y); }
.uno-card.uno-G { background: var(--uno-g); }
.uno-card.uno-B { background: var(--uno-b); }
.uno-card.is-wild {
  background: conic-gradient(from 45deg,
    var(--uno-r) 0 25%, var(--uno-y) 0 50%, var(--uno-g) 0 75%, var(--uno-b) 0);
}

.uno-card__corner {
  position: absolute;
  font-size: var(--uno-fs);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.uno-card__corner--tl { left: 5px; top: 4px; }
.uno-card__corner--br { right: 5px; bottom: 4px; transform: rotate(180deg); }

.uno-card__oval {
  position: absolute;
  inset: 15% 9%;
  background: rgba(255, 255, 255, .94);
  border-radius: 50%;
  transform: rotate(24deg);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
}

.uno-card__oval b {
  display: block;
  transform: rotate(-24deg);
  font-size: var(--uno-fs-oval);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  color: #262b33;
}
.uno-card.uno-R .uno-card__oval b { color: var(--uno-r); }
.uno-card.uno-Y .uno-card__oval b { color: #a8790a; }
.uno-card.uno-G .uno-card__oval b { color: var(--uno-g); }
.uno-card.uno-B .uno-card__oval b { color: var(--uno-b); }
.uno-card.is-wild .uno-card__oval b { color: #1d2128; }

.uno-card--back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #2c2f38, #14161b);
  display: grid;
  place-items: center;
}
.uno-card__logo {
  font-weight: 900;
  font-style: italic;
  color: #ffd166;
  font-size: 17px;
  letter-spacing: -.05em;
  transform: rotate(-18deg);
  text-shadow: 0 2px 0 #b32020;
}

.uno-card--mini {
  --uno-fs: 11px;
  --uno-fs-oval: 17px;
  width: 44px;
  height: 64px;
  border-width: 2px;
  border-radius: 7px;
}

/* ---------------- 手牌 / 别人的牌 ---------------- */

.uno-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-height: 140px;
  padding: 24px 6px 4px;
}

.uno-hand .uno-card { cursor: pointer; }

.uno-hand .uno-card.is-dim {
  filter: grayscale(.6) brightness(.6);
  cursor: not-allowed;
}

.uno-hand .uno-card.is-playable {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45), 0 0 0 2px rgba(255, 255, 255, .5);
}

.uno-hand .uno-card.is-playable:not(.is-selected):hover { transform: translateY(-10px); }

/* 放在最后，保证选中态优先于「可出牌」高亮 */
.uno-hand .uno-card.is-selected {
  transform: translateY(-24px);
  box-shadow: 0 0 0 3px var(--gold), 0 12px 24px rgba(0, 0, 0, .5);
}

.uno-fan {
  display: flex;
  align-items: center;
  height: 48px;
  padding-left: 4px;
}
.side--right .uno-fan { flex-direction: row-reverse; padding-left: 0; padding-right: 4px; }

.uno-fan .uno-card {
  width: 26px;
  height: 38px;
  border-radius: 5px;
  border-width: 2px;
  margin-left: -16px;
}
.uno-fan .uno-card:first-child { margin-left: 0; }
.uno-fan .uno-card__logo { font-size: 9px; }
.uno-fan__more { margin-left: 5px; font-size: 12px; opacity: .7; }

/* ---------------- UNO 徽标 / 按钮 ---------------- */

.uno-badge {
  position: absolute;
  left: -6px;
  top: -10px;
  background: linear-gradient(180deg, #ff5a5a, #c81f1f);
  color: #fff;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .06em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 4px 14px rgba(200, 30, 30, .65);
  animation: pop .25s ease-out;
  z-index: 6;
}

.btn--uno {
  background: linear-gradient(180deg, #ff8080, #d8383a 58%, #a51f21);
  color: #fff;
  border-color: rgba(255, 255, 255, .55);
  box-shadow: 0 6px 18px rgba(200, 40, 40, .5);
}

#unoShout.is-live { animation: shout-pulse .9s ease-in-out infinite; }

@keyframes shout-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 90, 90, .75); }
  50% { transform: scale(1.07); box-shadow: 0 0 0 14px rgba(255, 90, 90, 0); }
}

.uno-shout-flash {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-size: clamp(38px, 8vw, 88px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: .03em;
  color: #ffd166;
  text-shadow: 0 0 34px rgba(255, 90, 90, .9), 0 6px 0 #b32020, 0 12px 26px rgba(0, 0, 0, .6);
  pointer-events: none;
  z-index: 70;
  white-space: nowrap;
}
.uno-shout-flash.is-pop { animation: shout-pop .55s cubic-bezier(.2, 1.7, .4, 1); }

@keyframes shout-pop {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(-14deg); opacity: 0; }
  55% { transform: translate(-50%, -50%) scale(1.16) rotate(4deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
}

/* ---------------- 选色弹窗 ---------------- */

.modal__box--color { width: min(380px, 100%); }

.color-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 18px 22px 4px;
}

.color-btn {
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 14px;
  padding: 22px 0;
  cursor: pointer;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .45);
  transition: transform .12s, filter .2s;
}
.color-btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.color-btn:active { transform: translateY(1px); }
.color-btn.c-red { background: var(--uno-r); }
.color-btn.c-yellow { background: var(--uno-y); }
.color-btn.c-green { background: var(--uno-g); }
.color-btn.c-blue { background: var(--uno-b); }

.color-picker__hint {
  margin: 0;
  padding: 12px 22px 20px;
  font-size: 12.5px;
  opacity: .6;
  text-align: center;
}

/* 记分条 */
.score__bar {
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.score__bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6fd3a6, var(--gold));
  transition: width .4s ease;
}

/* ------------------------------------------------------------------ 响应式 */

@media (max-width: 720px) {
  :root { --card-w: 56px; --card-h: 78px; }
  .screen.is-active { gap: 5px; padding: 6px 8px 8px; }
  .brand__name { font-size: 17px; }
  .brand em, .select span { display: none; }
  .seat { min-width: 0; padding: 6px 9px; gap: 7px; }
  .avatar { width: 34px; height: 34px; font-size: 18px; border-radius: 9px; }
  .seat__name { font-size: 13px; }
  .seat__count b { font-size: 16px; }
  .status { font-size: 12px; min-height: 34px; }
  .btn { padding: 9px 18px; font-size: 14px; }
  .btn--wide { padding: 11px 34px; }
  .fan { height: 34px; }
  .fan .back { width: 18px; height: 27px; margin-left: -12px; }
  .played { min-height: 48px; }
  .card--mini { width: 34px; height: 47px; border-radius: 5px; padding: 2px 3px; }
  .card--mini .c-rank { font-size: 11px; }
  .card--mini .c-suit { font-size: 9px; }
  .card--mini .c-big { font-size: 14px; }
  .card--mini.joker .c-rank { font-size: 9px; }
  .card--mini.joker .c-suit { font-size: 11px; }
  .scoreboard { gap: 5px; }
  .score { font-size: 11px; padding: 3px 8px; }
  .tool { padding: 5px 10px; font-size: 12px; }
  .board, .uno-board { gap: 6px; }

  /* 菜单 */
  .menu__modes { grid-template-columns: 1fr; gap: 12px; }
  .mode-card { padding: 16px 16px 14px; gap: 10px; }
  .mode-card__art { height: 58px; }
  .mini-face, .mini-uno { width: 38px; height: 54px; font-size: 15px; border-radius: 6px; }
  .mini-uno { height: 58px; }
  .mode-card__body h2 { font-size: 19px; }
  .mode-card__body p { font-size: 12px; margin-bottom: 8px; }
  .mode-card__go { right: 16px; bottom: 14px; font-size: 13px; }
  .menu__foot { gap: 8px; padding: 8px 10px; }
  .menu__hint { display: none; }

  /* UNO */
  .uno-card { --uno-fs: 12px; --uno-fs-oval: 22px; width: 54px; height: 80px; border-width: 2px; border-radius: 8px; }
  .uno-card--mini { --uno-fs: 9px; --uno-fs-oval: 12px; width: 32px; height: 47px; }
  .uno-deckpile { width: 54px; height: 80px; }
  .uno-deckpile__logo { font-size: 15px; }
  .uno-discard { min-width: 54px; min-height: 80px; }
  .uno-hand { min-height: 104px; padding-top: 18px; }
  .uno-fan { height: 34px; }
  .uno-fan .uno-card { width: 18px; height: 27px; margin-left: -11px; }
  .uno-fan .uno-card__logo { font-size: 6px; }
  .uno-chip { font-size: 11px; padding: 3px 9px; }
  .score__bar { width: 28px; }
}

@media (max-width: 540px) {
  .seat { flex-direction: column; gap: 1px; padding: 5px 6px; align-items: center; }
  .seat__meta { text-align: center; }
  .avatar { width: 26px; height: 26px; font-size: 14px; border-radius: 8px; }
  .seat__name { font-size: 11px; }
  .seat__role { font-size: 9px; padding: 0 4px; margin-top: 1px; }
  .seat__count { font-size: 10px; text-align: center; }
  .seat__count b { font-size: 14px; }
  .seat__count i { display: none; }
  .bubble { right: 50%; transform: translateX(50%); bottom: -12px; font-size: 11px; padding: 2px 8px; }
  .bottom { padding: 22px 6px 6px; gap: 3px; }
  .hand-hint { font-size: 11px; }
  .uno-badge { left: 50%; transform: translateX(-50%); top: -9px; font-size: 9px; padding: 1px 6px; }
  .uno-card--mini { width: 26px; height: 38px; }
  .uno-card--mini .uno-card__oval b { font-size: 10px; }
  .color-btn { font-size: 15px; padding: 16px 0; }
  .mode-card__go { display: none; }
}

@media (max-height: 620px) {
  .status { min-height: 26px; font-size: 12px; }
  .played { min-height: 44px; }
  .fan { height: 30px; }
  .uno-hand { min-height: 96px; padding-top: 14px; }
  .uno-card { height: 92px; }
  .uno-deckpile, .uno-discard { min-height: 92px; height: 92px; }
}
