* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1400px 900px at 50% 12%, #17293c 0%, #0e1822 55%, #0a111a 100%) fixed;
  color: #e8eef4;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.muted { color: #8aa0b4; font-size: 13px; }

.screen { max-width: 860px; margin: 0 auto; padding: 24px 16px; }
.back-hub { display: inline-block; color: #6fc2ff; text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.back-hub:hover { text-decoration: underline; }
.screen h1 { text-align: center; margin-bottom: 20px; font-size: 26px; }
.screen h2 { font-size: 16px; margin-bottom: 10px; color: #cfe0ee; }

.panel {
  background: #18242f;
  border: 1px solid #263845;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.home-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .home-cols { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: #8aa0b4; margin: 8px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #34495c; background: #0f1923; color: #e8eef4;
  font-size: 15px; outline: none;
}
input:focus { border-color: #4d9fd6; }

.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px;
  border: 1px solid #3c5268; background: #24364a; color: #e8eef4;
  font-size: 15px; cursor: pointer; margin-top: 10px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: #1f7a4d; border-color: #2a9e65; }
.btn.danger { background: #6b2530; border-color: #8d3441; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.small { padding: 5px 10px; font-size: 13px; margin-top: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.row select { flex: 1; }
.row .btn { white-space: nowrap; }

.room-list { max-height: 220px; overflow-y: auto; }
.room-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px; border-bottom: 1px solid #263845; gap: 8px;
}
.room-item .btn { margin-top: 0; padding: 6px 14px; }
.join-code { display: flex; gap: 8px; margin-top: 12px; }
.join-code .btn { margin-top: 0; }
.footer { text-align: center; margin-top: 10px; }

.share { font-size: 15px; word-break: break-all; margin-bottom: 6px; }
.share b { color: #6fc2ff; }

.player-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 4px; border-bottom: 1px solid #263845; font-size: 15px;
}
.player-row:last-child { border-bottom: none; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: #2c3f53; color: #9fc1dd; margin-left: 6px;
}
.tag.host { background: #6b5424; color: #ffd97a; }
.tag.easy { background: #1f4d33; color: #8fe6b4; }
.tag.medium { background: #54481f; color: #f0d77c; }
.tag.hard { background: #5c2730; color: #ff9aa8; }

/* ===== 牌桌 ===== */
#game-wrap { display: flex; gap: 12px; max-width: 1600px; margin: 0 auto; padding: 10px; height: 100vh; }
#game-left { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#game-topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; color: #8aa0b4; font-size: 13px; }
#game-topbar .btn.small { border-radius: 14px; border-color: #3d5266; }

/* 正规德州桌:跑道形(racetrack)椭圆,长宽比约 2:1
   大小随窗口缩放(宽、高双重约束),margin:auto 在剩余空间垂直居中(偏上) */
#table-felt {
  position: relative; flex: none;
  aspect-ratio: 2 / 1;
  width: min(96%, calc((100vh - 300px) * 2));
  margin: auto;
  background: radial-gradient(ellipse at center, #343b46 0%, #272d37 62%, #1a1f27 100%);
  border: 5px solid #4a3826;
  border-radius: 9999px; /* 两端半圆、长边平直 */
  box-shadow:
    inset 0 0 60px rgba(0,0,0,.5),
    0 0 0 1px rgba(201,154,80,.22),
    0 0 26px rgba(201,154,80,.10);
}

/* 底部功能区:固定高度,胜率面板显示/隐藏都不改变整体布局 */
#bottom-zone {
  flex: none; height: 176px;
  display: flex; flex-direction: column; justify-content: flex-end;
}

/* 桌面端:解除表单宽度限制,避免大窗口下牌桌被挤得过窄 */
@media (min-width: 761px) {
  #screen-game { max-width: none; padding: 0; }
}

#table-center {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  text-align: center;
}
#community { display: flex; gap: 7px; justify-content: center; min-height: 64px; }
#pot {
  display: inline-block; margin-top: 10px; font-size: 16px; font-weight: 700; color: #ffe08a;
  background: rgba(0,0,0,.32); border: 1px solid rgba(255,224,138,.28);
  padding: 3px 16px; border-radius: 16px; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
#stage-label {
  display: block; font-size: 12px; color: #bfe3cd; margin-top: 6px; letter-spacing: 1px;
}

.card {
  width: 44px; height: 62px; border-radius: 7px;
  background: linear-gradient(160deg, #ffffff 0%, #f0f2e9 100%); color: #20242a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.05);
  font-size: 17px; line-height: 1.05;
}
.card .suit { font-size: 19px; }
.card.red { color: #d8252f; }
.card.back {
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.16), transparent 62%),
    repeating-linear-gradient(45deg, #2f63a6, #2f63a6 4px, #24508a 4px, #24508a 8px);
  border: 2px solid #e4e9f0;
}
.card.small { width: 34px; height: 48px; font-size: 13px; }
.card.small .suit { font-size: 14px; }
.card.big { width: 60px; height: 84px; font-size: 23px; border-radius: 9px; }
.card.big .suit { font-size: 26px; }
.card.slot {
  background: rgba(255,255,255,.05);
  border: 1.5px dashed rgba(255,255,255,.22); box-shadow: none;
}

/* 牌桌颜色主题 */
/* 默认(dark)= 深灰蓝绒面;其余为可选主题 */
body[data-felt="green"] #table-felt { background: radial-gradient(ellipse at center, #1d6b43 0%, #14502f 70%, #0d3a22 100%); border-color: #3a2a1a; }
body[data-felt="blue"] #table-felt { background: radial-gradient(ellipse at center, #1d4f6b 0%, #143a50 70%, #0c2837 100%); }
body[data-felt="red"] #table-felt { background: radial-gradient(ellipse at center, #7a2230 0%, #5c1a26 70%, #40121b 100%); }

/* 牌背主题 */
body[data-back="red"] .card.back { background: radial-gradient(circle at 50% 42%, rgba(255,255,255,.16), transparent 62%), repeating-linear-gradient(45deg, #a52d3e, #a52d3e 4px, #8a2233 4px, #8a2233 8px); }
body[data-back="green"] .card.back { background: radial-gradient(circle at 50% 42%, rgba(255,255,255,.16), transparent 62%), repeating-linear-gradient(45deg, #218351 0%, #218351 4px, #1a6a41 4px, #1a6a41 8px); }
body[data-back="gold"] .card.back { background: radial-gradient(circle at 50% 42%, rgba(255,255,255,.10), transparent 62%), repeating-linear-gradient(45deg, #303030, #303030 4px, #202020 4px, #202020 8px); border-color: #d4af37; }

.seat {
  position: absolute; transform: translate(-50%, -50%);
  width: 118px; text-align: center; transition: box-shadow .2s;
}
.seat.me { width: 158px; z-index: 2; }
.seat.me .seat-cards { min-height: 84px; }
.seat.me .seat-name { font-size: 14px; }
.seat.me .seat-chips { font-size: 13px; }
.seat-box {
  background: linear-gradient(180deg, rgba(24,37,52,.96) 0%, rgba(12,20,30,.94) 100%);
  border: 1.5px solid #3d5266; border-radius: 12px;
  padding: 6px 5px 7px; position: relative;
  box-shadow: 0 5px 16px rgba(0,0,0,.45);
}
@keyframes seatPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,211,77,.30), 0 0 12px rgba(255,211,77,.45); }
  50%      { box-shadow: 0 0 0 2px rgba(255,211,77,.55), 0 0 24px rgba(255,211,77,.85); }
}
.seat.turn .seat-box { border-color: #ffd34d; animation: seatPulse 1.6s ease-in-out infinite; }
.seat.folded { opacity: 0.42; filter: saturate(.5); }
.seat.me .seat-box { border-color: #5aa7e0; }
.seat-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-chips { font-size: 12px; color: #ffd97a; }
.seat-cards { display: flex; gap: 3px; justify-content: center; margin-top: 4px; min-height: 48px; }
.seat-bet {
  margin-top: 4px; font-size: 12px; font-weight: 600; color: #ffe9b0;
  background: linear-gradient(#3d3115, #2b2210); display: inline-block;
  border: 1px solid rgba(255,217,122,.35);
  padding: 1px 10px; border-radius: 10px;
}
.seat-status { font-size: 11px; color: #ff9aa8; margin-top: 2px; }
.dealer-chip {
  position: absolute; top: -9px; right: -9px;
  width: 23px; height: 23px; border-radius: 50%;
  background: linear-gradient(#ffffff, #e3e3e3); color: #333; font-weight: 800; font-size: 12px;
  border: 1.5px solid #caa969;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.timer-text { font-size: 11px; color: #ffd34d; margin-top: 2px; }

#action-bar {
  position: relative;
  min-height: 68px; padding: 12px 4px 0;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center;
}
#action-bar .btn {
  margin-top: 0; min-width: 108px; padding: 12px 20px;
  font-size: 16px; font-weight: 700; border: none; border-radius: 24px;
  background: linear-gradient(#4f79b8, #375d96);
  box-shadow: 0 3px 0 rgba(0,0,0,.28), 0 6px 16px rgba(0,0,0,.35);
}
#action-bar .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.28); }
#action-bar .btn.danger { background: linear-gradient(#d95463, #a92f3e); }
#action-bar .btn.primary { background: linear-gradient(#35ad6c, #1e7a4b); }
#action-bar .waiting { color: #9db4c8; font-size: 14px; }
#raise-panel {
  /* 浮在操作按钮上方,不挤压底部布局 */
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: min(96%, 700px); z-index: 20;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  background: rgba(13,22,32,.96); border: 1px solid #3a5068; border-radius: 14px; padding: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
#raise-panel input[type=range] { flex: 1; min-width: 130px; accent-color: #ffd34d; }
#raise-panel input[type=number] { width: 110px; }
#raise-panel .quick {
  padding: 7px 12px; font-size: 13px; min-width: 0; font-weight: 600;
  background: #24364a; border-radius: 14px; box-shadow: none;
}

#log-panel {
  width: 240px; background: rgba(15,25,36,.82); border: 1px solid #2a3d50;
  border-radius: 14px; padding: 12px; display: flex; flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
#log-panel h3 {
  font-size: 14px; margin-bottom: 8px; padding-bottom: 8px; color: #cfe0ee;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
#log-lines { flex: 1; overflow-y: auto; font-size: 12px; line-height: 1.75; color: #b8cadb; }
#log-lines::-webkit-scrollbar { width: 5px; }
#log-lines::-webkit-scrollbar-thumb { background: #34495c; border-radius: 3px; }

#banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(8, 14, 20, 0.94); border: 1px solid #ffd34d;
  border-radius: 16px; padding: 20px 34px; text-align: center;
  font-size: 19px; font-weight: 700; z-index: 10;
  box-shadow: 0 0 0 4px rgba(255,211,77,.12), 0 10px 40px rgba(0,0,0,.65);
  backdrop-filter: blur(3px);
}
#banner .sub { font-size: 14px; color: #ffd97a; margin-top: 6px; }

/* 暂停 */
#pause-bar {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-top: 8px; padding: 8px 12px;
  background: #54481f; border: 1px solid #7a6a2e; border-radius: 10px;
  color: #ffe9b0; font-size: 14px;
}
#pause-bar .btn { margin-top: 0; }
#pause-overlay {
  position: absolute; inset: 0; z-index: 9;
  background: rgba(5, 10, 15, 0.55); border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
}
.pause-box {
  background: rgba(8, 14, 20, 0.93); border: 1px solid #4d9fd6;
  border-radius: 14px; padding: 20px 32px; text-align: center; font-size: 19px;
}
.pause-box .sub { font-size: 13px; color: #8aa0b4; margin-top: 8px; }
.pause-box .btn { margin-top: 14px; }

/* 胜率助手 */
#advice-panel {
  margin: 8px auto 0; padding: 8px 18px; max-width: 760px; align-self: center; width: 100%;
  background: rgba(13,22,32,.78); border: 1px solid rgba(255,255,255,.10); border-radius: 14px;
  font-size: 13px; color: #cfe0ee; text-align: center; line-height: 1.7;
  backdrop-filter: blur(4px);
}
#advice-panel .adv-win { color: #ffd97a; font-weight: 700; }
#advice-panel .adv-cat { display: inline-block; margin: 0 5px; color: #9fc1dd; white-space: nowrap; }
#advice-panel .adv-cat b { color: #8fe6b4; font-weight: 600; }

/* 结算横幅里的获胜牌型 */
#banner .win-hand { display: flex; gap: 5px; justify-content: center; margin: 10px 0 4px; }
#banner .win-type { font-size: 16px; color: #8fe6b4; font-weight: 700; }

/* 设置开关 */
.opt-row { margin: 4px 0 10px; }
.opt {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: #e8eef4; margin: 8px 0; cursor: pointer;
}
.opt input { width: 18px; height: 18px; accent-color: #2a9e65; }

/* 画面设置 */
#theme-panel {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#theme-panel .panel { width: 320px; max-width: 92vw; }
.swatches { display: flex; gap: 10px; margin: 6px 0 10px; }
.swatch {
  width: 56px; height: 40px; border-radius: 8px;
  border: 2px solid #34495c; cursor: pointer; padding: 0;
}
.swatch.sel { border-color: #ffd34d; box-shadow: 0 0 8px #ffd34d88; }
.sw-felt-green { background: radial-gradient(ellipse at center, #1d6b43, #14502f); }
.sw-felt-blue { background: radial-gradient(ellipse at center, #1d4f6b, #143a50); }
.sw-felt-red { background: radial-gradient(ellipse at center, #7a2230, #5c1a26); }
.sw-felt-dark { background: radial-gradient(ellipse at center, #3a3f47, #2a2e35); }
.sw-back-blue { background: repeating-linear-gradient(45deg, #2a5d9e, #2a5d9e 4px, #234e86 4px, #234e86 8px); }
.sw-back-red { background: repeating-linear-gradient(45deg, #9e2a3a, #9e2a3a 4px, #861f2e 4px, #861f2e 8px); }
.sw-back-green { background: repeating-linear-gradient(45deg, #1f7a4d, #1f7a4d 4px, #18613d 4px, #18613d 8px); }
.sw-back-gold { background: repeating-linear-gradient(45deg, #2e2e2e, #2e2e2e 4px, #1e1e1e 4px, #1e1e1e 8px); border-color: #d4af37; }

#toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #6b2530; border: 1px solid #8d3441; color: #fff;
  padding: 9px 18px; border-radius: 9px; font-size: 14px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
#toast.show { opacity: 1; }

#disconnected {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}

/* ===== 手机竖屏专属版:顶栏在上、高挑椭圆桌、大按钮 ===== */
@media (max-width: 760px) {
  #game-wrap { flex-direction: column; height: auto; padding: 0 0 8px; }
  /* 顶栏移到最上方 */
  #game-topbar {
    order: -1; flex-wrap: wrap; gap: 6px; padding: 8px 10px;
    background: rgba(8,14,20,.5);
  }
  #game-topbar > span:last-child { display: flex; gap: 6px; flex-wrap: wrap; }
  /* 竖屏高挑椭圆桌 */
  #table-felt {
    aspect-ratio: auto; width: auto; min-height: 52vh;
    margin: 26px 14px 46px; border-radius: 45% / 38%;
  }
  #pause-overlay { border-radius: 45% / 38%; }
  /* 底部功能区自然高度 */
  #bottom-zone { height: auto; min-height: 150px; }
  /* 胜率助手紧凑 */
  #advice-panel { font-size: 11px; padding: 6px 10px; line-height: 1.5; margin: 6px 10px 0; }
  /* 操作按钮:大而好点 */
  #action-bar { gap: 8px; padding: 10px 8px 0; }
  #action-bar .btn { flex: 1 1 28%; min-width: 92px; padding: 13px 0; font-size: 16px; }
  /* 座位与牌:紧凑防重叠 */
  .seat { width: 80px; }
  .seat.me { width: 116px; }
  .seat-box { padding: 4px 3px 5px; }
  .seat-name { font-size: 11px; }
  .seat-chips { font-size: 10px; }
  .seat-bet { font-size: 10px; padding: 0 6px; }
  .card { width: 32px; height: 45px; font-size: 13px; }
  .card .suit { font-size: 14px; }
  .card.small { width: 24px; height: 34px; font-size: 10px; }
  .card.small .suit { font-size: 10px; }
  .card.big { width: 44px; height: 62px; font-size: 17px; }
  .card.big .suit { font-size: 19px; }
  .seat.me .seat-cards { min-height: 62px; }
  .dealer-chip { width: 18px; height: 18px; font-size: 10px; top: -7px; right: -7px; }
  /* 记录在最下方 */
  #log-panel { width: auto; height: 140px; margin: 8px 10px 0; }
}
