:root { --table:#24634d; --gold:#ffd166; --white:#fffdf8; --muted:#b9d2c8; }
* { box-sizing:border-box; }
html,body { margin:0; min-height:100%; }
body { color:var(--white); background:radial-gradient(circle at 20% 0%,#286952 0,transparent 32rem),linear-gradient(135deg,#0d211c,#173d31); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif; }
button,input { font:inherit; } button { cursor:pointer; } .hidden { display:none!important; }

/* ── 顶栏 ── */
.topbar { height:72px; padding:0 max(16px,calc((100vw - 1080px)/2)); display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid rgba(255,255,255,.1); background:linear-gradient(180deg,rgba(8,20,37,.88),rgba(11,29,42,.68)); box-shadow:0 2px 14px rgba(0,0,0,.22); flex-shrink:0; }
.topbar-left { display:flex; align-items:center; gap:14px; min-width:0; }
.topbar-title { margin:0; font-size:22px; white-space:nowrap; }
.topbar-game { display:flex; align-items:center; gap:8px; min-width:0; }
.topbar-room-code { color:var(--gold); font-size:20px; font-weight:700; letter-spacing:4px; }
.topbar-round { color:var(--muted); font-size:12px; white-space:nowrap; }
.top-actions { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.connection { padding:5px 9px; border-radius:999px; font-size:12px; }
.connection.online { color:#a9f4b6; background:rgba(70,190,100,.16); }
.connection.offline { color:#ffd3a2; background:rgba(230,150,60,.16); }

/* ── 通用 ── */
.icon-button { width:28px; height:28px; padding:0; color:var(--white); border:0; border-radius:7px; background:rgba(255,255,255,.12); }
.auto-on { color:#33270c; background:var(--gold); }
.small-button { padding:7px 11px; color:var(--white); border:0; border-radius:9px; background:rgba(255,255,255,.12); font-size:12px; cursor:pointer; transition:.15s; }
.small-button:hover { background:rgba(255,255,255,.22); }
.danger-button { color:#ffd5d5; background:rgba(225,85,95,.2); }
.danger-button:hover { background:rgba(225,85,95,.35); }
.primary-button,.secondary-button,.bid-button { border:0; border-radius:10px; transition:.15s ease; cursor:pointer; }
.primary-button { width:100%; height:46px; margin-top:16px; color:#33270c; background:var(--gold); font-weight:700; }
.primary-button:hover { filter:brightness(1.08); transform:translateY(-1px); }
.secondary-button { min-width:100px; height:46px; padding:0 16px; color:var(--white); background:rgba(255,255,255,.14); }
.secondary-button:hover { background:rgba(255,255,255,.22); }
.bid-button { min-width:72px; height:42px; color:var(--white); background:rgba(255,255,255,.14); }
.bid-button:hover { color:#33270c; background:var(--gold); }
.input { width:100%; height:46px; padding:0 13px; color:var(--white); border:1px solid rgba(255,255,255,.15); border-radius:10px; outline:none; background:rgba(0,0,0,.16); font:inherit; }
.input:focus { border-color:var(--gold); }
.link-button { padding:0; color:var(--gold); border:0; background:none; font-size:12px; text-decoration:underline; cursor:pointer; }
.toast { position:fixed; z-index:20; bottom:24px; left:50%; max-width:92%; padding:10px 16px; border-radius:999px; color:var(--white); background:rgba(15,22,19,.92); opacity:0; pointer-events:none; transform:translate(-50%,12px); transition:.2s ease; }
.toast.show { opacity:1; transform:translate(-50%,0); }

/* ── 主区域 ── */
.app-shell { display:flex; flex-direction:column; height:100vh; overflow:hidden; }
main { flex:1 1 0; min-height:0; width:min(1080px,100%); margin:0 auto; padding:16px 16px 0; }

/* ── 首页 / 大厅面板 ── */
.panel { width:min(460px,100%); margin:34px auto; padding:28px; border:1px solid rgba(255,255,255,.1); border-radius:20px; background:rgba(22,56,46,.94); box-shadow:0 18px 60px rgba(0,0,0,.18); }
.hero { margin-bottom:28px; text-align:center; }
.logo-card { width:70px; height:88px; margin:0 auto 14px; display:grid; place-items:center; color:#ef6f7b; border-radius:10px; background:var(--white); font-size:45px; transform:rotate(-6deg); box-shadow:8px 8px 0 rgba(0,0,0,.12); }
.hero h2 { margin:0 0 8px; } .hero p,.tip { color:var(--muted); font-size:13px; line-height:1.6; }
.field-label { display:block; margin-bottom:7px; color:var(--muted); font-size:12px; }
.small-label { color:var(--muted); font-size:12px; }
.room-options { display:grid; gap:8px; margin:14px 0 2px; }
.option-row { display:grid; grid-template-columns:20px 1fr; align-items:center; column-gap:6px; padding:9px 10px; border-radius:10px; background:rgba(255,255,255,.06); font-size:13px; }
.option-row input { grid-row:span 2; accent-color:var(--gold); }
.option-row small { color:var(--muted); font-size:10px; }
.divider { display:flex; align-items:center; gap:12px; margin:24px 0; color:var(--muted); font-size:12px; }
.divider::before,.divider::after { content:""; height:1px; flex:1; background:rgba(255,255,255,.12); }
.join-row { display:flex; gap:10px; }
.message { min-height:22px; color:var(--gold); text-align:center; }
.room-header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.room-actions { display:flex; align-items:center; gap:8px; }
.room-code { color:var(--gold); font-size:28px; letter-spacing:5px; }
.lobby-players { display:grid; gap:10px; margin:22px 0; }
.lobby-player { padding:13px 15px; display:flex; justify-content:space-between; align-items:center; border-radius:12px; background:rgba(0,0,0,.16); }
.lobby-player .seat { color:var(--muted); font-size:12px; }
.lobby-settings { display:flex; align-items:center; flex-wrap:wrap; gap:8px; color:var(--muted); font-size:11px; }
.lobby-settings span { padding:5px 8px; border-radius:999px; background:rgba(255,255,255,.08); }
.spectator-list { margin:4px 0 10px; padding:5px 8px; color:var(--muted); border-radius:8px; background:rgba(0,0,0,.12); font-size:12px; }
.seat-tools { display:inline-flex; gap:4px; margin-left:6px; vertical-align:middle; }
.seat-button { width:24px; height:24px; padding:0; color:var(--white); border:0; border-radius:6px; background:rgba(255,255,255,.14); line-height:24px; cursor:pointer; }
.seat-button:disabled { opacity:.25; cursor:not-allowed; }

/* ── 游戏面板 ── */
.game-panel { width:100%; height:100%; display:flex; flex-direction:column; gap:0; }

/* 台面 */
.table { position:relative; flex:1 1 0; min-height:0; overflow:hidden; border:4px solid #b98b3b; border-radius:46% 46% 42% 42% / 20% 20% 18% 18%; background:radial-gradient(ellipse at 50% 46%,rgba(59,152,111,.72) 0,rgba(22,91,72,.94) 46%,rgba(8,48,50,.98) 100%),var(--table); box-shadow:inset 0 0 0 7px rgba(255,214,116,.13),inset 0 0 46px rgba(0,0,0,.42),0 22px 48px rgba(0,0,0,.34); transform:perspective(1000px) rotateX(1deg); }
.table::before { content:""; position:absolute; inset:18px; border:1px solid rgba(255,255,255,.1); border-radius:22px; pointer-events:none; }

/* 台面内嵌信息条 */
.table-infobar { position:absolute; bottom:0; left:0; right:0; z-index:4; display:flex; justify-content:space-between; align-items:center; padding:4px 14px; background:rgba(0,0,0,.28); border-radius:0 0 4px 4px; min-height:22px; }
.table-message { color:var(--gold); font-size:12px; font-weight:600; }
.table-spectators { color:var(--muted); font-size:11px; }

/* 座位 */
.player-seat { position:absolute; z-index:2; width:130px; padding:10px 8px 8px; border-radius:14px; text-align:center; background:linear-gradient(180deg,rgba(23,46,63,.94),rgba(7,25,39,.88)); border:2px solid rgba(211,170,91,.4); box-shadow:0 6px 12px rgba(0,0,0,.26); }
.player-top { display:none; }
.player-left { top:50%; left:18px; transform:translateY(-50%); }
.player-right { top:50%; right:18px; transform:translateY(-50%); }
.player-bottom { left:50%; bottom:26px; transform:translateX(-50%); }
.player-seat.active { border-color:var(--gold); box-shadow:0 0 0 2px rgba(255,209,102,.25),0 0 20px rgba(255,209,102,.22); }
.current-turn { animation:turnPulse 1.4s ease-in-out infinite; }
@keyframes turnPulse { 0%,100% { box-shadow:0 0 0 2px rgba(255,209,102,.2),0 0 10px rgba(255,209,102,.14); } 50% { box-shadow:0 0 0 3px rgba(255,209,102,.6),0 0 26px rgba(255,209,102,.4); } }
.turn-badge { display:none; position:absolute; top:-10px; left:50%; padding:2px 7px; color:#33270c; border-radius:999px; background:var(--gold); font-size:10px; font-weight:700; transform:translateX(-50%); }
.turn-badge.visible { display:block; }
.player-avatar { position:absolute; top:-20px; left:7px; width:28px; height:28px; display:grid; place-items:center; border:2px solid rgba(255,255,255,.18); border-radius:50%; background:linear-gradient(145deg,#3b8c70,#173d31); font-size:15px; }
.player-bottom .player-avatar { top:-26px; left:-2px; }
.player-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:700; font-size:13px; }
.player-role { min-height:16px; color:var(--gold); font-size:10px; }
.player-meta { color:var(--muted); font-size:10px; }
.robot-mark { display:inline-block; margin-left:4px; font-size:13px; filter:drop-shadow(0 0 3px rgba(255,209,102,.5)); }
.player-seat.viewable { cursor:pointer; }
.player-seat.viewable:hover { border-color:var(--gold); }
.seat-action { min-height:44px; display:flex; justify-content:flex-start; align-items:flex-end; margin-top:6px; overflow:hidden; }
.seat-action .mini-card { width:26px; height:38px; font-size:8px; flex-shrink:0; margin-left:-17px; }
.seat-action .mini-card:first-child { margin-left:0; }
.seat-pass { min-height:44px; display:grid; place-items:center; margin-top:6px; color:#ffd6a1; font-size:12px; font-weight:700; }

/* 台面中心元素 */
.bottom-deck { position:absolute; top:12px; left:50%; z-index:3; display:flex; flex-direction:column; align-items:center; gap:4px; padding:5px; border-radius:9px; background:rgba(0,0,0,.18); transform:translateX(-50%); }
.bottom-title { color:var(--muted); font-size:10px; }
.mini-cards { display:flex; justify-content:center; min-height:44px; }
.mini-card { width:30px; height:44px; margin-left:-4px; display:flex; flex-direction:column; justify-content:center; align-items:center; color:#171717; border-radius:5px; background:var(--white); font-size:9px; box-shadow:0 2px 4px rgba(0,0,0,.18); }
.mini-card.red,.card.red { color:#d74455; }
.table-last-play { position:absolute; top:50%; left:50%; z-index:3; display:flex; justify-content:center; transform:translate(-50%,-50%); }
.table-last-play .mini-card { width:36px; height:52px; font-size:10px; }
.spectator-views { position:absolute; top:10px; right:12px; z-index:4; display:flex; gap:4px; }
.view-button { width:22px; height:22px; padding:0; color:var(--muted); border:1px solid rgba(255,255,255,.15); border-radius:50%; background:rgba(0,0,0,.22); font-size:10px; cursor:pointer; }
.view-button.selected { color:#33270c; border-color:var(--gold); background:var(--gold); }
.result-banner { position:absolute; z-index:5; top:50%; left:50%; width:min(300px,78%); padding:16px; color:#33270c; border-radius:14px; background:var(--gold); text-align:center; font-weight:700; transform:translate(-50%,-50%); box-shadow:0 12px 36px rgba(0,0,0,.3); }

/* 手牌区 */
.my-area { position:relative; z-index:10; flex-shrink:0; margin-top:8px; margin-bottom:12px; padding:10px 12px 12px; border-radius:14px; background:rgba(16,40,32,.96); border:1px solid rgba(255,255,255,.07); }
.my-info { display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-size:13px; margin-bottom:8px; }
.spectator-area { } .spectator-area .controls { display:none; }
.action-bar {
  position:absolute;
  z-index:6;
  bottom:26px;
  left:50%;
  transform:translateX(-50%);
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  gap:8px;
  /* 最宽不超过台面 80%，最小 240px */
  width:clamp(240px, 70%, 420px);
}
.hand { display:flex; justify-content:center; flex-wrap:wrap; align-items:flex-end; padding:4px 0 0; min-height:80px; }
.card { position:relative; width:48px; height:70px; margin:3px; flex-shrink:0; color:#171717; border:1px solid rgba(0,0,0,.18); border-radius:8px; background:var(--white); box-shadow:0 3px 5px rgba(0,0,0,.2); transition:transform .12s ease; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.card:hover { transform:translateY(-4px); }
.card.selected { transform:translateY(-14px); box-shadow:0 0 0 3px var(--gold),0 5px 10px rgba(0,0,0,.25); }
.card-rank { font-size:15px; font-weight:700; }
.card-suit { font-size:18px; }
.card.joker .card-rank { display:block; font-size:14px; }
.card.joker .card-suit { display:none; }
.controls { display:flex; justify-content:center; gap:8px; margin-top:10px; }
/* controls 在 action-bar 内时撑满整行 */
.action-bar > .controls { margin:0; flex:1; justify-content:stretch; }
.action-bar > .controls .primary-button,
.action-bar > .controls .secondary-button,
.action-bar > .controls .bid-button { flex:1; min-width:0; width:auto; margin:0; }
#playControls { max-width:320px; margin-left:auto; margin-right:auto; width:100%; }
#playControls .primary-button, #playControls .secondary-button { flex:1; width:auto; height:42px; margin:0; min-width:0; padding:0 8px; }

/* 动画 */
.table.dealing::after { content:""; position:absolute; z-index:1; top:50%; left:50%; width:32px; height:46px; border-radius:5px; background:linear-gradient(135deg,#d84a58,#8f2231); box-shadow:0 0 0 2px rgba(255,255,255,.22); transform:translate(-50%,-50%); animation:dealCard 1.2s ease-out both; }
@keyframes dealCard { 0% { opacity:0; transform:translate(-50%,-50%) scale(.5) rotate(-20deg); } 15% { opacity:1; } 100% { opacity:0; transform:translate(-50%,-120%) scale(1) rotate(10deg); } }
.dealing-hand .card { animation:handDeal .6s cubic-bezier(.2,.8,.2,1) both; }
.dealing-hand .card:nth-child(3n+1) { animation-delay:.04s; } .dealing-hand .card:nth-child(3n+2) { animation-delay:.13s; } .dealing-hand .card:nth-child(3n) { animation-delay:.22s; }
@keyframes handDeal { from { opacity:0; transform:translateY(-80px) scale(.7) rotate(5deg); } to { opacity:1; transform:none; } }

/* ══════════════════════════════════════════
   竖屏手机
══════════════════════════════════════════ */
@media (max-width:650px) {

  /* ── 顶栏 ── */
  .topbar { height:54px; padding:0 14px; }
  .topbar-title { font-size:19px; }
  .topbar-room-code { font-size:17px; letter-spacing:3px; }
  main { padding:8px 10px 20px; overflow-y:auto; }

  /* ── 首页/大厅面板 ── */
  .panel { padding:20px 16px; margin:10px auto; }

  /* ── 台面：圆角矩形，无椭圆裁剪 ── */
  .table {
    min-height:360px;
    border-radius:20px;        /* 圆角矩形，不再裁剪内部元素 */
    transform:none;
  }
  .table::before { inset:10px; border-radius:12px; }

  /* 台面信息条：移到顶部 */
  .table-infobar {
    top:0; bottom:auto;
    border-radius:18px 18px 0 0;
    padding:4px 14px; min-height:24px;
    background:rgba(0,0,0,.32);
  }
  .table-message { font-size:12px; }
  .table-spectators { font-size:11px; }

  /* 底牌：信息条正下方居中，横排 */
  .bottom-deck {
    top:28px; left:50%; transform:translateX(-50%);
    flex-direction:row; align-items:center;
    gap:5px; padding:4px 10px;
    background:rgba(0,0,0,.22); border-radius:8px;
  }
  .bottom-title {
    font-size:9px; writing-mode:vertical-rl;
    letter-spacing:1px; margin:0; color:var(--muted);
  }
  .mini-cards { min-height:0; }
  .mini-card { width:24px; height:34px; font-size:8px; margin-left:-5px; border-radius:4px; }

  /* 对手座位卡：底牌下方，左家左上、右家右上
     用 left/right + top 定位，不用 transform，避免裁剪 */
  .player-seat {
    width:130px; padding:6px 8px 5px 32px;
    border-radius:10px; border-width:1px;
    text-align:left;
  }
  .player-avatar {
    top:50%; left:8px; transform:translateY(-50%);
    width:22px; height:22px; font-size:11px;
  }
  .player-name { font-size:11px; }
  .player-role { font-size:10px; min-height:14px; }
  .player-meta { font-size:10px; }
  .turn-badge { font-size:9px; top:-8px; padding:1px 6px; }
  .robot-mark { font-size:12px; }

  .player-left  { top:72px; left:8px;  transform:none; }
  .player-right { top:72px; right:8px; transform:none; }
  .player-bottom { display:none; }

  /* hover：scale 代替 translateY */
  .player-seat.viewable:hover { transform:scale(1.03); }

  /* 座位出牌记录 */
  .seat-action { min-height:28px; margin-top:4px; overflow:hidden; }
  .seat-action .mini-card { width:20px; height:28px; font-size:7px; flex-shrink:0; margin-left:-17px; }
  .seat-action .mini-card:first-child { margin-left:0; }
  .seat-pass {
    min-height:28px; font-size:10px; margin-top:4px;
    display:flex; align-items:center; justify-content:flex-start;
  }

  /* 上次出牌：台面垂直中心，牌放大 */
  .table-last-play {
    top:50%; left:50%;
    transform:translate(-50%, -50%);
    min-height:0;
  }
  .table-last-play .mini-card { width:40px; height:56px; font-size:12px; margin-left:-6px; }

  /* 操作按钮：台面底部，留出圆角空间 */
  .action-bar {
    bottom:14px;
    width:clamp(260px, 80%, 380px);
    gap:8px;
  }
  .action-bar > .controls { gap:8px; }
  .action-bar > .controls .primary-button,
  .action-bar > .controls .secondary-button,
  .action-bar > .controls .bid-button {
    height:44px; font-size:14px; border-radius:10px;
  }

  /* ── 手牌区 ── */
  .my-area { margin-top:10px; padding:10px 12px 12px; border-radius:12px; }
  .my-info { font-size:12px; margin-bottom:6px; }
  .hand {
    min-height:74px; padding:2px 0 0;
    display:flex; flex-wrap:wrap;
    align-content:flex-start;
    justify-content:flex-start;
    align-items:flex-end;
    overflow:visible;
  }
  .hand .card {
    flex:0 0 auto;
    margin:0 var(--pt-step, 3px) 4px 0;
  }
  .hand .card:last-child { margin-right:0; }
  .card { width:44px; height:64px; margin:3px 2px; border-radius:7px; }
  .card-rank { font-size:14px; }
  .card-suit { font-size:17px; }
  .card.joker .card-rank { font-size:13px; }
  .card.selected { transform:translateY(-12px); }
}


/* ══════════════════════════════════════════
   PC / 平板宽屏（> 800px，非横屏手机）
══════════════════════════════════════════ */
@media (min-width:800px) and (min-height:600px) {

  /* ── 顶栏 ── */
  .topbar { height:64px; }
  .topbar h1, .topbar-title { font-size:24px; }
  .icon-button { width:32px; height:32px; font-size:15px; }
  .connection { font-size:13px; }

  /* ── 首页面板：居中，宽度适当放大 ── */
  .panel { width:min(520px,100%); padding:36px 32px; }
  .logo-card { width:80px; height:100px; font-size:52px; }
  .hero h2 { font-size:22px; }
  .input { height:50px; font-size:15px; }
  .primary-button { height:50px; font-size:15px; }
  .secondary-button { height:50px; }

  /* ── 游戏：台面撑满，手牌区在底部 ── */
  main { padding:12px 20px 0; overflow:hidden; }

  /* 座位卡：更宽大，字体更清晰 */
  .player-seat { width:170px; padding:14px 12px 10px 38px; border-radius:16px; }
  .player-avatar { width:32px; height:32px; font-size:18px; top:-24px; left:8px; }
  .player-bottom .player-avatar { top:-30px; }
  .player-name { font-size:15px; }
  .player-role { font-size:12px; min-height:18px; }
  .player-meta { font-size:12px; }
  .turn-badge { font-size:11px; padding:3px 9px; }
  .robot-mark { font-size:15px; }

  /* 座位位置：左右居中高度，底部 */
  .player-left  { left:28px; top:42%; transform:translateY(-50%); }
  .player-right { right:28px; top:42%; transform:translateY(-50%); }
  .player-bottom { display:none; }  /* my-area 代替 */

  /* 出牌记录 */
  .seat-action { min-height:56px; margin-top:8px; }
  .seat-action .mini-card { width:32px; height:46px; font-size:10px; margin-left:-20px; }
  .seat-action .mini-card:first-child { margin-left:0; }
  .seat-pass { min-height:56px; font-size:14px; }

  /* 台面中心：底牌放大 */
  .bottom-deck { top:16px; gap:6px; padding:8px 14px; border-radius:12px; }
  .bottom-title { font-size:12px; }
  .mini-card { width:38px; height:54px; font-size:11px; margin-left:-5px; }
  .mini-cards { min-height:54px; }

  /* 上次出牌放大 */
  .table-last-play .mini-card { width:50px; height:72px; font-size:14px; margin-left:-8px; }

  /* 台面信息条 */
  .table-infobar { padding:5px 20px; min-height:28px; }
  .table-message { font-size:14px; }
  .table-spectators { font-size:13px; }

  /* 操作按钮放大 */
  .action-bar {
    bottom:34px;
    width:clamp(300px, 55%, 500px);
    gap:10px;
  }
  .action-bar > .controls { gap:10px; }
  .action-bar > .controls .primary-button,
  .action-bar > .controls .secondary-button,
  .action-bar > .controls .bid-button {
    height:50px; font-size:15px; border-radius:12px;
  }

  /* 手牌区：一排，和横屏手机同逻辑 */
  .my-area { padding:14px 20px 16px; border-radius:16px; margin-bottom:16px; }
  .my-info { font-size:14px; margin-bottom:10px; }
  .hand {
    min-height:82px;
    display:flex; flex-wrap:nowrap;
    align-items:flex-end; justify-content:flex-start;
    padding:4px 0 0; overflow:visible;
  }
  .card {
    flex:0 0 auto;
    width:56px; height:82px;
    margin:0 var(--ls-step, 3px) 0 0;
    border-radius:10px;
  }
  .card:last-child { margin-right:0; }
  .card-rank { font-size:18px; }
  .card-suit { font-size:22px; }
  .card.joker .card-rank { font-size:16px; }
  .card.selected { transform:translateY(-18px); z-index:10; box-shadow:0 0 0 3px var(--gold),0 6px 14px rgba(0,0,0,.28); }
  .card:hover { transform:translateY(-6px); }

  /* 结果 banner */
  .spectator-views { top:14px; right:18px; gap:5px; }
  .view-button { width:28px; height:28px; font-size:12px; }
  .result-banner { padding:22px 32px; font-size:20px; border-radius:18px; }

  .player-left.viewable:hover  { transform:translateY(-50%) scale(1.03); filter:none; }
  .player-right.viewable:hover { transform:translateY(-50%) scale(1.03); filter:none; }
}


/* ══════════════════════════════════════════
   大屏首页两栏布局（> 1100px）
══════════════════════════════════════════ */
@media (min-width:1100px) and (min-height:600px) {
  /* 首页面板可以稍宽一些，大屏有足够空间 */
  .panel { width:min(560px,100%); }
}

/* ══════════════════════════════════════════
   横屏手机
   台面：矩形，对手上方左右分列，中心出牌区
   手牌：固定底部全宽一排堆叠
══════════════════════════════════════════ */
@media (orientation:landscape) and (max-height:600px) {

  /* ── 顶栏 ── */
  .topbar { height:36px; padding:0 10px; }
  .topbar-title { font-size:14px; }
  .topbar-room-code { font-size:16px; letter-spacing:3px; }
  .topbar-round { font-size:11px; }
  .icon-button { width:24px; height:24px; font-size:12px; }
  .connection { padding:2px 7px; font-size:10px; }
  .small-button { padding:4px 8px; font-size:11px; }
  main { padding:2px 5px 0; }

  /* ── 游戏面板：纵向 flex ── */
  .game-panel { height:calc(100vh - 36px); display:flex; flex-direction:column; gap:0; }

  /* ── 台面 ── */
  .table {
    flex:1 1 0; min-height:0;
    /* 矩形，横向铺满 */
    border-radius:10px; border-width:2px;
    transform:none;
    margin-bottom:2px;
    /* 重置竖屏的椭圆 */
    border-radius:10px;
  }
  .table::before { inset:8px; border-radius:6px; }

  /* 对手座位卡：横向排在台面上部
     左家：左上角；右家：右上角；自己(bottom)：横屏隐藏，信息移到手牌区 */
  .player-seat {
    width:auto; min-width:110px; max-width:160px;
    padding:5px 8px 5px 30px; /* 左留给头像 */
    border-radius:8px; border-width:1px;
    text-align:left;
  }
  .player-name { font-size:10px; white-space:nowrap; }
  .player-role { font-size:9px; min-height:12px; }
  .player-meta { font-size:9px; }
  .player-avatar { width:20px; height:20px; font-size:10px; top:50%; left:6px; transform:translateY(-50%); }
  .player-bottom .player-avatar { top:50%; left:6px; transform:translateY(-50%); }
  .turn-badge { font-size:8px; padding:1px 6px; top:-8px; left:50%; }
  .robot-mark { font-size:10px; }

  /* 左家：左上 */
  .player-left { top:8px; left:6px; transform:none; }
  /* 右家：右上 */
  .player-right { top:8px; right:6px; transform:none; }
  /* 自己(bottom)：横屏隐藏，信息内联到手牌区 */
  .player-bottom { display:none; }

  /* hover 去掉 translateY，改用 scale */
  .player-seat.viewable:hover { transform:scale(1.03); }
  .player-left.viewable:hover { transform:none; filter:brightness(1.1); }
  .player-right.viewable:hover { transform:none; filter:brightness(1.1); }

  /* 出牌记录和 pass 标记：横向 */
  .seat-action { min-height:20px; margin-top:3px; overflow:hidden; }
  .seat-action .mini-card { width:16px; height:24px; font-size:6px; flex-shrink:0; margin-left:-13px; }
  .seat-action .mini-card:first-child { margin-left:0; }
  .seat-pass { min-height:20px; font-size:9px; margin-top:3px;
    justify-content:flex-start; display:flex; align-items:center; padding-left:0; }

  /* ── 底牌：台面顶部居中，夹在两个对手座位之间 ── */
  .bottom-deck {
    top:6px; left:50%; transform:translateX(-50%);
    flex-direction:row; align-items:center;
    gap:5px; padding:3px 8px;
    background:rgba(0,0,0,.28); border-radius:7px;
  }
  .bottom-title { font-size:8px; writing-mode:vertical-rl; letter-spacing:1px; margin:0; color:var(--muted); }
  .mini-cards { min-height:0; }
  .mini-card { width:18px; height:26px; font-size:6px; margin-left:-4px; border-radius:3px; }

  /* 上次出牌：台面垂直中心 */
  .table-last-play {
    top:50%; bottom:auto;
    left:50%; transform:translate(-50%, -50%);
    min-height:0;
  }
  .table-last-play .mini-card { width:26px; height:37px; font-size:9px; }

  /* 台面底部信息条 */
  .table-infobar {
    padding:2px 10px; min-height:20px;
    display:flex; align-items:center; justify-content:space-between;
  }
  .table-message { font-size:11px; font-weight:600; color:var(--gold); }
  .table-spectators { font-size:10px; color:var(--muted); }

  /* 观战视角切换按钮 */
  .spectator-views { top:auto; bottom:24px; right:6px; gap:3px; }
  .view-button { width:19px; height:19px; font-size:9px; }

  /* 结果 banner */
  .result-banner { padding:8px 16px; font-size:13px; border-radius:10px; }

  /* ── 手牌区：固定底部全宽 ── */
  #myArea {
    flex-shrink:0;
    /* 高度：my-info行(30px) + 手牌(clamp(40,17vh,60)px) + 上下padding(8px) */
    height:calc(clamp(40px, 17vh, 60px) + 24px);
    margin:0; padding:3px 8px 4px;
    border-radius:8px 8px 0 0;
    box-shadow:0 -4px 16px rgba(0,0,0,.3);
    display:flex; flex-direction:column; gap:0;
    overflow:visible;
    background:rgba(18,46,38,.98);
  }

  /* my-info 行：牌数信息 */
  .my-info {
    flex-shrink:0;
    display:flex; align-items:center; justify-content:space-between;
    font-size:10px; line-height:1.2;
    height:20px; margin-bottom:2px;
  }
  #handTitle { font-weight:600; color:var(--white); white-space:nowrap; }
  #handCount { color:var(--muted); white-space:nowrap; }

  /* action-bar 已移入台面，此处无需样式 */
  /* action-bar 横屏：台面内绝对定位，bottom 紧贴信息条上方 */
  .action-bar {
    bottom:22px;
    gap:6px;
    width:clamp(200px, 65%, 380px);
  }
  .action-bar > .controls { gap:5px; }
  /* 横屏按钮稍矮 */
  .action-bar > .controls .primary-button,
  .action-bar > .controls .secondary-button,
  .action-bar > .controls .bid-button {
    height:30px; font-size:11px; padding:0 4px;
    border-radius:7px;
  }
  .bid-button { color:var(--white); background:rgba(255,255,255,.14); }

  /* 手牌：一排堆叠 */
  .hand {
    flex-shrink:0; display:flex; flex-wrap:nowrap;
    align-items:flex-end; justify-content:flex-start;
    padding:0; min-height:0; overflow:visible;
  }
  .card {
    flex:0 0 auto;
    height:clamp(40px, 17vh, 60px);
    width:calc(clamp(40px, 17vh, 60px) * 0.68);
    margin:0 var(--ls-step, -6px) 0 0;
    border-radius:5px; z-index:1;
  }
  .card:last-child { margin-right:0; }
  .card.selected { transform:translateY(-10px); z-index:10; box-shadow:0 0 0 2px var(--gold),0 4px 10px rgba(0,0,0,.3); }
  .card-rank { font-size:calc(clamp(40px,17vh,60px) * 0.22); line-height:1.1; }
  .card-suit { font-size:calc(clamp(40px,17vh,60px) * 0.26); line-height:1; }
  .card.joker .card-rank { font-size:calc(clamp(40px,17vh,60px) * 0.17); }

  .toast { bottom:4px; }
  .spectator-area .controls { display:none; }
}

.wait-hint { margin:10px 0 0; color:var(--muted); font-size:13px; text-align:center; min-height:18px; }

/* 剩余牌数 ≤5 警示色 */
.danger-cards { color:#ff8c69 !important; font-weight:700; }

.rules-panel { margin-top:-18px; max-height:80vh; display:flex; flex-direction:column; }
.rules-header { display:flex; justify-content:space-between; align-items:center; flex-shrink:0; }
.rules-header h2 { margin:0; }
.rules-body { overflow-y:auto; flex:1; padding-right:4px; margin-top:14px; }
.rules-section { margin-bottom:18px; }
.rules-section h3 { margin:0 0 8px; font-size:14px; color:var(--gold); }
.rules-section p { margin:0 0 6px; color:var(--muted); font-size:13px; line-height:1.6; }
.rules-section ul { margin:6px 0 0 0; padding-left:18px; color:var(--muted); font-size:13px; line-height:1.8; }
.rules-section strong { color:var(--white); }
.rules-grid { display:grid; grid-template-columns:28px 1fr; gap:8px 10px; align-items:start; color:var(--muted); font-size:13px; line-height:1.5; }
.rules-grid p { margin:0; }
.rules-grid span { padding-top:1px; }