/* ══════════════════════════════════════════════════════
   雀魂麻将 · 游戏样式 v7
   参照原版雀魂布局：左右深色木边框 + 全屏绿色牌桌
══════════════════════════════════════════════════════ */
:root {
  --gold:    #ffd700;
  --gold-dk: #c8a800;
  --tile-w:  44px;  --tile-h:  62px;
  --sm-w:    26px;  --sm-h:    38px;
  --xs-w:    18px;  --xs-h:    26px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #0a0808;
  font-family: '微软雅黑', 'Microsoft YaHei', sans-serif;
  color: #fff;
  overflow: hidden;
  height: 100%;
  user-select: none;
  /* 防止 Bootstrap normalize 覆盖移动端字体大小 */
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* ══ 最外层 ══ */
#app {
  display: flex;
  flex-direction: column;
  height: 100svh;
  width: 100vw;
  perspective: 1100px;
  perspective-origin: 50% -10%;
}

/* ══ 牌桌行：左木框 | 内容 | 右木框 ══ */
#table {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  transform: rotateX(5deg);
  transform-origin: 50% 98%;
  transform-style: preserve-3d;
}

/* ── 左右深色木边框 ── */
#border-left,
#border-right {
  width: 58px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 12px;
  gap: 10px;
  position: relative;
  z-index: 5;
  /* 深酒红木纹 */
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,.022) 0px, rgba(255,255,255,.022) 1px,
      transparent 1px, transparent 9px
    ),
    linear-gradient(180deg, #1a0505 0%, #4a1010 35%, #3a0c0c 65%, #1a0505 100%);
  box-shadow: inset -4px 0 14px rgba(0,0,0,.55);
}
#border-right {
  box-shadow: inset 4px 0 14px rgba(0,0,0,.55);
}

/* 左侧设置按钮 */
.settings-btn {
  background: none;
  border: 1px solid rgba(200,160,96,.4);
  color: #c8a060;
  font-size: 1.1rem;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  flex-shrink: 0;
  font-family: inherit;
}
.settings-btn:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.4); }

/* 宝牌（绝对定位，table-inner 左上角） */
#dora-panel {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,215,0,.3);
  border-radius: 8px;
  padding: 4px 8px;
  pointer-events: none;
}
.dora-lbl {
  font-size: .55rem;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: .06em;
  white-space: nowrap;
}
#dora-tiles {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
}

/* ══ 牌桌主内容（竖向三行） ══ */
#table-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,.012) 0px, rgba(255,255,255,.012) 1px,
      transparent 1px, transparent 8px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,.012) 0px, rgba(255,255,255,.012) 1px,
      transparent 1px, transparent 8px
    ),
    radial-gradient(ellipse 85% 65% at 50% 45%,
      #2e9456 0%, #1e6038 50%, #133d24 100%);
}
/* 桌面动态光晕 */
#table-inner::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 45% 35% at 50% 48%,
    rgba(90,220,150,.11) 0%, transparent 70%);
  animation: tableBreath 6s ease-in-out infinite;
}
@keyframes tableBreath {
  0%,100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.08); }
}

/* ══ 上家区域 ══ */
#player-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 0 2px;
  gap: 3px;
  min-height: 0;
}

/* ══ 中间行（左家 | 中央 | 右家） ══ */
#middle-row {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
}

/* ══ 下家区域 ══ */
#player-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0 4px;
  gap: 3px;
}

/* ══ 玩家公共 ══ */
.player-area { display: flex; flex-direction: column; align-items: center; }

.player-area.left,
.player-area.right {
  width: 76px;
  flex-shrink: 0;
  justify-content: center;
  gap: 4px;
}

/* 头像（方形，1:1） */
.avatar {
  width: 52px; height: 52px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.28);
  transition: border-color .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;
}
.avatar.thinking::before {
  content: ''; position: absolute; inset: -5px; border-radius: 8px;
  border: 3px solid transparent; border-top-color: var(--gold);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ 头像块：方形头像 + 名称黑底白字 ══ */
.av-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  transition: background .3s;
}
.av-block.active-bg { background: rgba(255,215,0,.10); }

.av-name {
  width: 100%;
  min-width: 52px;
  height: 28px;
  background: #000;
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 4px;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* 侧家头像块：稍小适配 76px 列宽 */
.av-block-side .avatar { width: 50px; height: 50px; font-size: 1.5rem; }
.av-block-side .av-name { min-width: 50px; }

/* 玩家头部 */
.player-header {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 8px;
  transition: background .3s;
}
.player-header.active-bg { background: rgba(255,215,0,.12); }
.p-name  { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.p-score { font-size: .68rem; color: #ffe066; }

/* 风牌徽章 */
.p-wind-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  background: rgba(255,215,0,.18); border: 1px solid rgba(255,215,0,.45);
  color: var(--gold); font-size: .68rem; font-weight: 900;
  flex-shrink: 0;
}

/* 侧家分数 */
.side-score { font-size: .64rem; color: #ffe066; }

/* 立直棒 */
.riichi-stick {
  background: linear-gradient(135deg, #9b59b6, #6c3483);
  color: #fff; font-size: .55rem; font-weight: 900;
  padding: 2px 4px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,.3);
  animation: riichiPulse 1.2s ease infinite;
}
@keyframes riichiPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(155,89,182,.6); }
  50%      { box-shadow: 0 0 0 5px rgba(155,89,182,0); }
}

/* ══ 手牌区域 ══ */
.hand-outer {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

/* ══ 底部（东家）：手牌行 + 头像块横排 ══ */
.bottom-play-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}

/* ══ 上家（北）：头像块 + 手牌行横排 ══ */
.top-play-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}

/* ══ 底部状态条（立直/风/分） ══ */
.bottom-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  transition: background .3s;
}
.bottom-footer.active-bg { background: rgba(255,215,0,.10); }

/* ══ 上家状态条 ══ */
.top-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  transition: background .3s;
}
.top-status.active-bg { background: rgba(255,215,0,.10); }

/* ══ 侧家（左/右）状态条 ══ */
.side-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border-radius: 8px;
  transition: background .3s;
}
.side-status.active-bg { background: rgba(255,215,0,.10); }

.hand-wrap { display: flex; align-items: flex-end; gap: 4px; }
.hand-row  { display: flex; gap: 2px; position: relative; z-index: 1; }
.meld-row  { display: flex; gap: 3px; align-items: flex-end; position: relative; z-index: 1; }
.bottom-hand { flex-direction: row; }
.top-hand    { flex-direction: row-reverse; }

/* 上家手牌 180° */
.top-hand .tile { transform: rotate(180deg); }

/* 左右家手牌竖列 */
.left-hand,
.right-hand {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.left-hand  .hand-row,
.right-hand .hand-row {
  display: flex; flex-direction: column; gap: 1px; align-items: center;
}
.left-hand  .meld-row,
.right-hand .meld-row { flex-direction: column; align-items: center; gap: 2px; }
.left-hand  .meld-group,
.right-hand .meld-group { flex-direction: column; align-items: center; }

/* 左 90° / 右 -90°，sm: 26×38 → margin 补偿 -6px */
.left-hand  .tile {
  transform: rotate(90deg);
  margin-top:    calc((var(--sm-w) - var(--sm-h)) / 2);
  margin-bottom: calc((var(--sm-w) - var(--sm-h)) / 2);
}
.right-hand .tile {
  transform: rotate(-90deg);
  margin-top:    calc((var(--sm-w) - var(--sm-h)) / 2);
  margin-bottom: calc((var(--sm-w) - var(--sm-h)) / 2);
}

/* 立直牌各位置横置 */
.tile.riichi-tile               { transform: rotate(90deg);  margin: 4px 8px; }
.left-hand  .tile.riichi-tile   { transform: rotate(180deg); margin: 2px auto; }
.right-hand .tile.riichi-tile   { transform: rotate(0deg);   margin: 2px auto; }
.top-hand   .tile.riichi-tile   { transform: rotate(270deg); margin: 4px 8px; }

/* ══ 中央牌桌 ══ */
#center {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: stretch;
  position: relative; min-width: 0;
}
#center-deco {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: .04; pointer-events: none; z-index: 0;
}
#center-wind-big { font-size: 7rem; font-weight: 900; }

/* ══ 四向弃牌区总容器 ══ */
#discard-table {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 4px;
  background: rgba(0,0,0,.13);
  overflow: hidden;
  margin: 3px;
}
#dt-middle { flex: 1; display: flex; min-height: 0; }
#dt-core {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; padding: 4px;
}

.dt-zone { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; overflow: hidden; }

/* 上家弃牌：倒向，右起 */
.dt-top {
  border-bottom: 1px solid rgba(255,255,255,.09);
  flex-direction: row-reverse;
  max-height: 84px;
  align-content: flex-start; align-items: flex-start;
}
.dt-top .tile { transform: rotate(180deg); }

/* 下家弃牌：正向 */
.dt-bottom {
  border-top: 1px solid rgba(255,255,255,.09);
  max-height: 84px;
  align-content: flex-start; align-items: flex-start;
}

/* 左家弃牌：竖列 90° */
.dt-left {
  flex-direction: column; width: 34px; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.09);
  align-items: center; justify-content: flex-start; overflow: hidden;
}
.dt-left .tile {
  transform: rotate(90deg);
  margin: calc((var(--xs-w) - var(--xs-h)) / 2) 0;
}

/* 右家弃牌：竖列 -90° */
.dt-right {
  flex-direction: column; width: 34px; flex-shrink: 0;
  border-left: 1px solid rgba(255,255,255,.09);
  align-items: center; justify-content: flex-start; overflow: hidden;
}
.dt-right .tile {
  transform: rotate(-90deg);
  margin: calc((var(--xs-w) - var(--xs-h)) / 2) 0;
}

/* 最新弃牌高亮 */
.dt-zone .tile.discard-new { outline: 2px solid rgba(255,215,0,.65); outline-offset: 1px; }

/* 最后打出牌 + 状态 */
#last-discard-area {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .68rem; color: #bbb;
}
#status-label {
  font-size: .76rem; color: var(--gold);
  min-height: 1.2em; text-align: center;
}

/* ══ 中央正方形信息板 ══ */
#center-board { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.cb-mid-row   { display: flex; align-items: center; gap: 8px; }

.cb-score   { display: flex; gap: 2px; min-width: 44px; }
.cb-top, .cb-bottom { flex-direction: column; align-items: center; text-align: center; }
.cb-left    { flex-direction: column; align-items: center; text-align: center; }
.cb-right   { flex-direction: column; align-items: center; text-align: center; }
.cb-name    { font-size: .62rem; color: #bbb; line-height: 1.4; white-space: nowrap; }
.cb-pts     { font-size: .86rem; font-weight: 700; color: #ffe066; line-height: 1.3; white-space: nowrap; }

/* 分数文字朝向各自玩家 */
.cb-top   { transform: rotate(180deg); }
.cb-left  { transform: rotate(90deg);  }
.cb-right { transform: rotate(-90deg); }

.cb-score.active-player .cb-name { color: var(--gold); }
.cb-score.active-player .cb-pts  { color: var(--gold); text-shadow: 0 0 8px rgba(255,215,0,.5); }
.cb-score.riichi-player .cb-pts  { color: #d7aaff; }

/* 正方形主体 */
#cb-square {
  position: relative; width: 100px; height: 100px;
  border: 2px solid rgba(255,215,0,.5); border-radius: 12px;
  background: rgba(0,0,0,.52);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,215,0,.1), inset 0 0 28px rgba(0,0,0,.4);
}
.cb-corner {
  position: absolute; font-size: .62rem; font-weight: 900;
  background: var(--gold-dk); color: #000;
  padding: 1px 5px; line-height: 1.65; z-index: 1;
}
.cb-tl { top: 0; left: 0;   border-radius: 10px 2px 6px 2px; }
.cb-tr { top: 0; right: 0;  border-radius: 2px 10px 2px 6px; }
.cb-bl { bottom: 0; left: 0;  border-radius: 2px 6px 2px 10px; }
.cb-br { bottom: 0; right: 0; border-radius: 6px 2px 10px 2px; }
.cb-corner.active-corner { background: var(--gold); box-shadow: 0 0 7px rgba(255,215,0,.7); }

#cb-inner {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
#cb-round-wind {
  font-size: 2.4rem; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,.6); line-height: 1;
}
#cb-deck-info   { display: flex; align-items: baseline; gap: 2px; }
#cb-deck-num    { font-size: 1.1rem; font-weight: 700; color: #fff; }
.cb-deck-unit   { font-size: .6rem; color: #aaa; }
#cb-honba-info  { font-size: .72rem; color: #ccc; display: flex; align-items: baseline; gap: 1px; }
#cb-honba, #cb-kyotaku { font-weight: 700; color: #ffe066; }

/* ══ 麻将牌 ══ */
.tile {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fffef5, #fffae8);
  color: #1a1a1a; border: 1px solid #d4c9a8; border-radius: 5px;
  font-weight: 700; white-space: nowrap; cursor: default;
  position: relative;
  box-shadow: 0 3px 0 #8a7a5a, 1px 4px 8px rgba(0,0,0,.38);
  transition: transform .15s cubic-bezier(.22,1,.36,1), box-shadow .15s, border-color .15s;
}
/* 牌面顶部高光 */
.tile::before {
  content: ''; position: absolute;
  top: 1px; left: 2px; right: 2px; height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.5) 0%, transparent 100%);
  border-radius: 4px 4px 0 0; pointer-events: none;
}
.tile::after {
  content: ''; position: absolute;
  bottom: -3px; left: 2px; right: 2px; height: 4px;
  background: rgba(0,0,0,.2); border-radius: 0 0 5px 5px; z-index: -1;
}
.tile.lg { width: var(--tile-w); height: var(--tile-h); font-size: 1.2rem; }
.tile.sm { width: var(--sm-w);   height: var(--sm-h);   font-size: .84rem; }
.tile.xs { width: var(--xs-w);   height: var(--xs-h);   font-size: .62rem; }

/* 万/筒/索 牌竖向排列 */
.suit-m,
.suit-p,
.suit-s { flex-direction: column; align-items: center; gap: 0; padding: 1px 2px; }

/* 万字牌：数字黑色，万字繁体红色 */
.t-num  { color: #1a1a1a; font-weight: 800; line-height: 1.15; }
.t-wan  { color: #c0392b; font-weight: 900; font-size: .78em; line-height: 1.1; }

/* 索子牌：索字绿色 */
.t-sou  { color: #27ae60; font-weight: 900; font-size: .78em; line-height: 1.1; }

/* 筒子牌：全黑 */
.t-pin  { color: #1a1a1a; font-weight: 700; font-size: .78em; line-height: 1.1; }

/* 四风牌：黑色字体偏大 */
.t-wind { color: #1a1a1a; font-weight: 900; font-size: 1.12em; }

/* 中：红色偏大 */
.t-chun { color: #c0392b; font-weight: 900; font-size: 1.18em; }

/* 発（发）：绿色偏大 */
.t-hatsu { color: #27ae60; font-weight: 900; font-size: 1.12em; }

.tile.clickable { cursor: pointer; }
.tile.clickable:hover {
  transform: translateY(-15px) scale(1.1);
  box-shadow: 0 3px 0 #8a7a5a, 2px 16px 28px rgba(0,0,0,.55),
              0 0 22px rgba(255,215,0,.45);
  border-color: var(--gold); z-index: 10;
  background: linear-gradient(160deg, #fffff0, #fff6c0);
}
/* 轮到你出牌时手牌整体微发光 */
.my-turn-glow { filter: drop-shadow(0 0 6px rgba(255,215,0,.28)); }

.tile.riichi-ok {
  cursor: pointer; border-color: #9b59b6;
  box-shadow: 0 3px 0 #6c3483, 1px 4px 12px rgba(155,89,182,.55);
  background: linear-gradient(160deg, #f5eeff, #ead6ff);
  animation: riichiOkPulse 1.2s ease infinite;
}
@keyframes riichiOkPulse {
  0%,100% { box-shadow: 0 3px 0 #6c3483, 1px 4px 12px rgba(155,89,182,.55); }
  50%     { box-shadow: 0 3px 0 #6c3483, 1px 4px 18px rgba(155,89,182,.9), 0 0 14px rgba(200,100,255,.5); }
}
.tile.riichi-ok:hover {
  transform: translateY(-15px) scale(1.1);
  box-shadow: 0 3px 0 #6c3483, 2px 16px 28px rgba(155,89,182,.75),
              0 0 28px rgba(200,80,255,.6);
  border-color: #d35ef9; z-index: 10;
}
/* 赤宝牌（红5）：温暖红色背景 + 红色数字 */
.tile.tile-aka {
  background: linear-gradient(160deg, #fff6f5, #ffe8e5, #ffd0cc);
  border-color: #e8b0aa;
  box-shadow: 0 3px 0 #9a5050, 1px 4px 8px rgba(180,0,0,.22);
}
.tile.tile-aka::before {
  background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, transparent 100%);
}
.t-num.aka {
  color: #cc1a1a;
  text-shadow: 0 0 6px rgba(204,26,26,.3);
}

.tile.back {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  border-color: #0d47a1; color: transparent;
}
.tile.back::before {
  content: ''; position: absolute; inset: 3px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 2px;
  background: repeating-linear-gradient(
    45deg, rgba(255,255,255,.03) 0px, rgba(255,255,255,.03) 2px,
    transparent 2px, transparent 6px);
}
.meld-group { display: flex; gap: 1px; }
.meld-group .tile { border-color: #e67e22; }

/* ══ 动画 ══ */
@keyframes dealIn {
  0%   { opacity: 0; transform: translateY(-40px) rotate(-15deg) scale(.5); }
  60%  { opacity: 1; transform: translateY(4px) rotate(1.5deg) scale(1.07); }
  80%  { transform: translateY(-1px) rotate(-.5deg) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.anim-deal { animation: dealIn .42s cubic-bezier(.22,1,.36,1) both; }

@keyframes aiFlip {
  0%   { opacity: 0; transform: rotateY(90deg) scale(.65); }
  50%  { opacity: 1; transform: rotateY(-8deg) scale(1.08); }
  75%  { transform: rotateY(3deg) scale(1.02); }
  100% { opacity: 1; transform: rotateY(0) scale(1); }
}
.anim-flip { animation: aiFlip .42s cubic-bezier(.22,1,.36,1) both; }

@keyframes dropIn {
  0%   { opacity: 0; transform: scale(1.6) translateY(-12px); }
  60%  { opacity: 1; transform: scale(1.06) translateY(2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.anim-drop { animation: dropIn .26s cubic-bezier(.22,1,.36,1) both; }

@keyframes meldFlash {
  0%,100% { box-shadow: 0 3px 0 #8a7a5a, 0 0 0 0 rgba(255,215,0,.8); border-color: var(--gold); }
  40%     { box-shadow: 0 3px 0 #8a7a5a, 0 0 0 9px rgba(255,215,0,0); border-color: var(--gold); }
}
.anim-meld { animation: meldFlash .55s ease 2; }

@keyframes handSway {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-2px); }
  75%     { transform: translateX(2px); }
}
.hand-thinking { animation: handSway .5s ease infinite; }

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 1; transform: translateY(-44px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-65px) scale(.9); }
}
#float-label {
  position: fixed; z-index: 5000; pointer-events: none;
  font-size: 1.6rem; font-weight: 900; color: var(--gold);
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  animation: floatUp .9s ease forwards;
}

@keyframes scorePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.45); color: #ffd700; }
  100% { transform: scale(1); }
}
.score-pop { animation: scorePop .42s ease; }

#win-flash {
  position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  animation: winFlash .75s ease forwards;
}
@keyframes winFlash {
  0%   { background: rgba(255,215,0,.65); }
  100% { background: rgba(255,215,0,0); }
}
#win-flash.yakuman { animation: yakumanFlash 1s ease forwards; }
@keyframes yakumanFlash {
  0%   { background: rgba(220,50,50,.8); }
  50%  { background: rgba(255,215,0,.6); }
  100% { background: rgba(220,50,50,0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
#status-label { animation: fadeInUp .3s ease; }

/* ══ 大字提示 ══ */
#big-announce {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  z-index: 6000; pointer-events: none;
  font-size: 3.2rem; font-weight: 900;
  text-shadow: 0 0 40px currentColor, 0 0 80px currentColor, 0 4px 24px rgba(0,0,0,.8);
  letter-spacing: .15em;
  filter: drop-shadow(0 0 16px currentColor);
}
@keyframes bigAnnounceAnim {
  0%   { opacity: 0; transform: scale(.3) translateY(32px) rotate(-6deg); }
  14%  { opacity: 1; transform: scale(1.28) translateY(-8px) rotate(1.5deg); }
  26%  { transform: scale(.97) translateY(0) rotate(0); }
  65%  { opacity: 1; transform: scale(1); }
  85%  { opacity: .7; }
  100% { opacity: 0; transform: scale(1.18) translateY(-22px); }
}

/* ══ 操作按钮栏 ══ */
#action-bar {
  display: flex; justify-content: center; align-items: center;
  gap: 10px; padding: 7px 12px; flex-shrink: 0;
  background: rgba(0,0,0,.52);
  border-top: 1px solid rgba(255,255,255,.07);
  min-height: 52px;
}
.act-btn {
  padding: 7px 22px; border: none; border-radius: 10px;
  font-size: .92rem; font-weight: 700; cursor: pointer;
  font-family: inherit; letter-spacing: .05em;
  transition: transform .15s, filter .15s;
  animation: btnPulse 1.5s ease infinite;
}
.act-btn.skip { animation: none; }
.act-btn:hover  { transform: translateY(-3px) scale(1.06); filter: brightness(1.15); }
.act-btn:active { transform: scale(.97); }
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); }
  50%     { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
}
.act-btn.tsumo  { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; }
.act-btn.ron    { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; }
.act-btn.riichi { background: linear-gradient(135deg, #9b59b6, #6c3483); color: #fff; }
.act-btn.pon    { background: linear-gradient(135deg, #e67e22, #d35400); color: #fff; }
.act-btn.chi    { background: linear-gradient(135deg, #2980b9, #1a5276); color: #fff; }
.act-btn.kan    { background: linear-gradient(135deg, #16a085, #0e6655); color: #fff; }
.act-btn.kita   { background: linear-gradient(135deg, #8e44ad, #5b2c6f); color: #fff; }
.act-btn.skip   { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }
#action-bar.riichi-mode { background: rgba(60,0,80,.6); border-top-color: rgba(155,89,182,.5); }

/* ══ 弹窗 ══ */
.game-modal {
  background: rgba(10,30,18,.95) !important;
  border: 1px solid rgba(255,215,0,.3) !important;
  color: #fff !important; backdrop-filter: blur(10px);
}
.game-modal .modal-header { border-color: rgba(255,255,255,.1) !important; }
.chi-opt {
  display: flex; gap: 2px; padding: 8px 10px;
  background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.2);
  border-radius: 10px; cursor: pointer; transition: transform .15s, border-color .15s;
}
.chi-opt:hover { transform: scale(1.06); border-color: var(--gold); }

.win-hand  { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin: 10px 0; }
.win-hl    { outline: 2px solid var(--gold); outline-offset: 2px; animation: meldFlash .7s ease infinite alternate; }
.score-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.score-chip { padding: 4px 12px; border-radius: 20px; font-size: .82rem; }
.chip-up    { background: rgba(39,174,96,.2);   color: #5dfc98; border: 1px solid #27ae60; }
.chip-down  { background: rgba(231,76,60,.2);   color: #ff7675; border: 1px solid #e74c3c; }
.chip-zero  { background: rgba(255,255,255,.08); color: #ccc;   border: 1px solid #555; }

.yaku-list    { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.yaku-chip    { padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; border: 1px solid; }
.yaku-normal  { background: rgba(52,152,219,.2); color: #74b9ff; border-color: #2980b9; }
.yaku-yakuman { background: rgba(220,50,50,.25); color: #ff6b6b; border-color: #e74c3c; animation: riichiPulse .8s ease infinite; }
.yaku-riichi  { background: rgba(155,89,182,.2); color: #d7aaff; border-color: #9b59b6; }
.yaku-dora    { background: rgba(255,215,0,.15); color: #ffd700; border-color: #c8a800; }
.yaku-aka     { background: rgba(220,50,50,.18); color: #ff9090; border-color: #cc3333; }
.han-badge    { font-size: .68rem; color: rgba(255,255,255,.6); margin-left: 3px; }
.han-fu-badge {
  display: inline-block; margin: 6px auto;
  padding: 4px 16px; border-radius: 20px;
  background: rgba(255,215,0,.18); border: 1px solid rgba(255,215,0,.5);
  color: #ffd700; font-size: .92rem; font-weight: 900; letter-spacing: .06em;
}

.gm-btn { padding: 8px 28px; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer; border: none; font-family: inherit; transition: transform .15s, filter .15s; }
.gm-btn:hover     { transform: translateY(-2px); filter: brightness(1.12); }
.gm-btn-gold      { background: var(--gold); color: #000; }
.gm-btn-outline   { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.4); text-decoration: none; display: inline-block; text-align: center; }

/* ══ Toast ══ */
.toast      { background: rgba(8,28,15,.95) !important; border: 1px solid rgba(255,255,255,.15) !important; color: #fff !important; min-width: 180px; }
.toast-body { color: #fff !important; font-size: .82rem; }

::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ══ 弃牌区增强 ══ */
.dt-zone .tile.discard-new {
  outline: 2px solid rgba(255,215,0,.8);
  outline-offset: 2px;
  animation: discardNewPulse 1.2s ease forwards;
}
@keyframes discardNewPulse {
  0%  { box-shadow: 0 3px 0 #8a7a5a, 0 0 0 0 rgba(255,215,0,.9); }
  50% { box-shadow: 0 3px 0 #8a7a5a, 0 0 0 8px rgba(255,215,0,0); }
  100%{ box-shadow: 0 3px 0 #8a7a5a; }
}

/* ══ 活跃玩家手牌光晕 ══ */
.bottom-outer.active-glow .hand-row {
  filter: drop-shadow(0 0 8px rgba(255,215,0,.35));
}

/* ══ 中央弃牌桌圆角美化 ══ */
#discard-table {
  border-radius: 10px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.2), 0 0 0 1px rgba(255,255,255,.06);
}

/* ══ 正方形信息板增强 ══ */
#cb-square {
  box-shadow: 0 0 0 1px rgba(255,215,0,.15),
              inset 0 0 30px rgba(0,0,0,.45),
              0 0 20px rgba(0,0,0,.3);
  transition: box-shadow .3s;
}

/* ══ 活跃头像呼吸效果 ══ */
.avatar.active {
  animation: avatarActive 1.8s ease infinite;
  border-color: var(--gold) !important;
}
@keyframes avatarActive {
  0%,100% { box-shadow: 0 0 0 3px rgba(255,215,0,.4), 0 0 12px rgba(255,215,0,.4); }
  50%     { box-shadow: 0 0 0 4px rgba(255,215,0,.6), 0 0 22px rgba(255,215,0,.75); }
}

/* ══ 按钮入场动画 ══ */
.act-btn {
  animation: btnAppear .25s cubic-bezier(.22,1,.36,1) both;
}
@keyframes btnAppear {
  from { opacity: 0; transform: translateY(10px) scale(.9); }
  to   { opacity: 1; transform: none; }
}

/* ══ 设置侧边栏（Offcanvas） ══ */
.game-offcanvas {
  background: rgba(6,22,12,.97) !important;
  border-right: 1px solid rgba(255,215,0,.2) !important;
  color: #fff !important;
  width: 300px !important;
  backdrop-filter: blur(12px);
}
.game-offcanvas .offcanvas-header {
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 12px 16px;
}
.game-offcanvas .offcanvas-title {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
}
.game-offcanvas .offcanvas-body {
  padding: 14px 16px;
  overflow-y: auto;
}
.game-offcanvas .offcanvas-body::-webkit-scrollbar { width: 3px; }
.game-offcanvas .offcanvas-body::-webkit-scrollbar-thumb { background: rgba(255,215,0,.2); }

.yr-divider { border-color: rgba(255,255,255,.1); margin: 10px 0; }
.yr-title {
  font-size: .72rem; font-weight: 900; color: var(--gold);
  letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 10px;
}

/* ══ 役种分组 ══ */
.yr-group { margin-bottom: 10px; }
.yr-header {
  font-size: .74rem; color: #ccc;
  padding-bottom: 3px; margin-bottom: 5px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.yr-header small { color: #888; font-size: .78em; }
.yr-han { color: var(--gold); font-size: .88rem; font-weight: 900; }
.yr-header-dora { color: #ffd700; }
.yr-header-yakuman { color: #ff8080; }

/* ══ 役种标签 ══ */
.yr-items { display: flex; flex-wrap: wrap; gap: 4px; }
.yr-item {
  padding: 2px 8px; border-radius: 12px; font-size: .7rem;
  background: rgba(255,255,255,.07); color: #ccc;
  border: 1px solid rgba(255,255,255,.14);
  white-space: nowrap;
}
.yr-item.yr-riichi { background: rgba(155,89,182,.18); color: #d7aaff; border-color: rgba(155,89,182,.5); }
.yr-item.yr-dora   { background: rgba(255,215,0,.12);  color: #ffd700; border-color: rgba(255,215,0,.4); }
.yr-item.yr-yakuman{
  background: rgba(220,50,50,.18); color: #ff9090; border-color: rgba(220,50,50,.5);
}
.yr-item.yr-double {
  background: rgba(220,50,50,.28); color: #ffb3b3; border-color: rgba(255,80,80,.7);
  font-weight: 700;
}

/* ══ 番符速查表 ══ */
.yr-table {
  width: 100%; border-collapse: collapse; font-size: .68rem;
  margin-bottom: 6px;
}
.yr-table th, .yr-table td {
  padding: 3px 6px; text-align: center;
  border: 1px solid rgba(255,255,255,.1);
}
.yr-table thead th { background: rgba(255,215,0,.12); color: var(--gold); }
.yr-table tbody tr:nth-child(odd) td { background: rgba(255,255,255,.03); }
.yr-table tr.yr-mangan td { background: rgba(255,215,0,.1); color: #ffd700; font-weight: 700; }

.yr-limits { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.yr-lim {
  font-size: .68rem; color: #aaa; padding: 2px 6px;
  background: rgba(255,255,255,.04); border-radius: 4px;
  border-left: 2px solid rgba(255,215,0,.3);
}

/* ══════════════════════════════════════════════════════
   移动端适配
══════════════════════════════════════════════════════ */

/* 竖屏手机：显示横屏提示，隐藏游戏 */
#rotate-hint { display: none; }

@media screen and (max-width: 600px) and (orientation: portrait) {
  #app { visibility: hidden; }
  #rotate-hint {
    display: flex !important;
    visibility: visible;
    position: fixed; inset: 0; z-index: 99999;
    align-items: center; justify-content: center;
    background: #0a1a10;
  }
  .rotate-box {
    text-align: center; color: #fff; padding: 2rem;
  }
  .rotate-icon {
    font-size: 3rem; display: block; margin-bottom: 1rem;
    animation: rotatePulse 2s ease infinite;
  }
  @keyframes rotatePulse {
    0%,100% { transform: rotate(0deg); opacity: .7; }
    50%     { transform: rotate(90deg); opacity: 1; }
  }
  .rotate-msg { font-size: 1.2rem; font-weight: 700; margin-bottom: .4rem; }
  .rotate-sub { font-size: .85rem; color: #90c8a8; }
}

/* 小屏横屏（手机横屏 / 小平板）：缩小牌桌 */
@media screen and (max-height: 520px),
       screen and (max-width: 768px) and (orientation: landscape) {
  :root {
    --tile-w: 30px; --tile-h: 44px;
    --sm-w:   18px; --sm-h:   26px;
    --xs-w:   13px; --xs-h:   19px;
  }

  /* 3D 效果减弱，避免切割视图 */
  #app  { perspective: 700px; }
  #table { transform: rotateX(3deg); }

  /* 收窄木框 */
  #border-left, #border-right { width: 40px; padding: 6px 4px; }
  .settings-btn { width: 28px; height: 28px; font-size: .85rem; }

  /* 收窄侧家列 */
  .player-area.left,
  .player-area.right { width: 54px; }

  /* 头像缩小 */
  .av-block .avatar       { width: 34px; height: 34px; font-size: 1.1rem; }
  .av-block .av-name      { height: 22px; font-size: .6rem; min-width: 34px; }
  .av-block-side .avatar  { width: 32px; height: 32px; font-size: 1rem; }
  .av-block-side .av-name { min-width: 32px; }

  /* 缩减间距 */
  .bottom-play-row { gap: 5px; }
  .top-play-row    { gap: 5px; }

  #player-top    { padding: 3px 0 1px; gap: 2px; }
  #player-bottom { padding: 1px 0 2px; gap: 2px; }

  .top-status,
  .bottom-footer { padding: 1px 4px; gap: 4px; }

  .side-status { padding: 1px 2px; gap: 2px; }
  .p-wind-badge { width: 16px; height: 16px; font-size: .6rem; }

  /* 操作按钮栏 */
  #action-bar { min-height: 40px; padding: 4px 8px; gap: 6px; }
  .act-btn    { padding: 5px 12px; font-size: .78rem; border-radius: 8px; }

  /* 宝牌面板 */
  #dora-panel { padding: 3px 5px; gap: 3px; }
  .dora-lbl   { font-size: .5rem; }

  /* 中央信息板 */
  #cb-square { width: 78px; height: 78px; }
  #cb-round-wind { font-size: 1.8rem; }
  .cb-pts { font-size: .72rem; }

  /* 设置侧边栏 */
  .game-offcanvas { width: 260px !important; }
}

/* 中等屏（平板竖屏 600–900px） */
@media screen and (min-width: 601px) and (max-width: 900px) and (orientation: portrait) {
  :root {
    --tile-w: 36px; --tile-h: 52px;
    --sm-w:   22px; --sm-h:   32px;
    --xs-w:   15px; --xs-h:   22px;
  }
  #app  { perspective: 900px; }
  #table { transform: rotateX(4deg); }
  #border-left, #border-right { width: 48px; }
  .player-area.left,
  .player-area.right { width: 62px; }
  .av-block .avatar      { width: 40px; height: 40px; font-size: 1.25rem; }
  .av-block-side .avatar { width: 38px; height: 38px; font-size: 1.15rem; }
  #action-bar { min-height: 46px; }
}

