:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1e252d;
  --line: #2a323c;
  --ink: #eef2f6;
  --muted: #93a1b0;
  --orange: #e8772e;
  --orange-2: #f59140;
  --red: #e2483f;
  --red-soft: #3a2020;
  --blue: #3f7be2;
  --blue-soft: #1f2a3a;
  --good: #46c07a;
  /* 语义层：把「橙」从具体颜色解耦为用途，橙只留给主 CTA / 当前焦点 / 进球得分 */
  --accent: var(--orange);              /* 唯一主强调 */
  --accent-2: var(--orange-2);
  --hover-line: rgba(255,255,255,.20);  /* 中性 hover 描边，替代橙 hover */
  --hi: rgba(255,255,255,.06);          /* 通用内高光 */
  /* 双层阴影：近实（贴边）+ 远虚（投影）+ 顶部内高光，制造层次 */
  --shadow: 0 1px 0 var(--hi), 0 10px 28px rgba(0,0,0,.45);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1b222b, transparent), var(--bg);
  color: var(--ink); font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 14px;
}
h1, h2, h3 { margin: 0; }
button { font-family: inherit; cursor: pointer; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #14181d, #1a1f26); }
.brand { display: flex; align-items: center; gap: 12px; }
.ball-ico { font-size: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.brand h1 { font-size: 20px; letter-spacing: 2px; color: var(--orange-2); }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.status { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.status span { padding: 5px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.dot.off { color: var(--muted); }
.dot.on { color: var(--good); border-color: var(--good); }

/* 背景音乐控件：音符按钮 + 下拉音量条 */
.bgm-wrap { position: relative; display: flex; align-items: center; }
.bgm-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--orange-2); }
.bgm-btn:hover { border-color: var(--orange-2); }
/* 抵消 .status span 的药丸样式，让音符仅作图标并整体旋转（速度随音量在 JS 里设 animation-duration） */
.status .bgm-note { display: inline-block; padding: 0; margin: 0; background: none; border: none; border-radius: 0; font-size: 15px; line-height: 1; }
.bgm-note.spin { animation: bgmSpin 2s linear infinite; }
@keyframes bgmSpin { to { transform: rotate(360deg); } }
.bgm-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.bgm-panel input[type="range"] { width: 120px; accent-color: var(--orange-2); }
.bgm-val { padding: 0; background: none; border: none; font-size: 11px; color: var(--muted); min-width: 30px; text-align: right; }

/* ============================================================
   主页 / 落地页（加入房间前的 hero）—— 纯 CSS，无图片依赖
   动态双色辉光 + 球场线 + 漂浮卡牌 + 篮球 + 玻璃质感入场卡
   ============================================================ */
/* 落地页时隐藏顶栏，让 hero 占满整屏（joinPanel 未隐藏 = 尚未进入房间） */
body:has(#joinPanel:not(.hidden)) .topbar { display: none; }

.join-hero { position: relative; min-height: 100dvh; overflow: hidden; display: grid; place-items: center; padding: 48px 24px; }

/* —— 背景层 —— */
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.hero-glow { position: absolute; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px; border-radius: 50%; filter: blur(90px); opacity: .55; }
.hero-glow.red { background: radial-gradient(circle, rgba(226,72,63,.75), transparent 62%); top: -22%; left: -14%; animation: heroDriftA 16s ease-in-out infinite; }
.hero-glow.blue { background: radial-gradient(circle, rgba(63,123,226,.75), transparent 62%); bottom: -26%; right: -14%; animation: heroDriftB 19s ease-in-out infinite; }
@keyframes heroDriftA { 50% { transform: translate(8%, 10%) scale(1.12); } }
@keyframes heroDriftB { 50% { transform: translate(-8%, -8%) scale(1.14); } }

/* 半透明球场线：中圈 + 三分弧 + 中线，缓慢呼吸 */
.hero-court { position: absolute; inset: 0; opacity: .14; animation: heroPulse 8s ease-in-out infinite; }
@keyframes heroPulse { 50% { opacity: .22; } }
.hero-court span { position: absolute; border: 2px solid var(--orange-2); }
.hc-circle { left: 50%; top: 50%; width: 380px; height: 380px; max-width: 70vw; max-height: 70vw; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; }
.hc-arc { left: 50%; top: 50%; width: 620px; height: 620px; max-width: 110vw; max-height: 110vw; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border-color: rgba(255,255,255,.5); border-style: dashed; }
.hc-line { left: 50%; top: 0; bottom: 0; border: none; border-left: 2px solid var(--orange-2); }

/* 漂浮卡牌（装饰）：发光顶条 + 图标光晕 + 玻璃高光 + 扫光，缓慢上下浮动 + 轻微旋转 */
.float-card {
  position: absolute; width: 90px; height: 120px; border-radius: 15px; overflow: hidden;
  background: linear-gradient(158deg, rgba(38,46,56,.96), rgba(12,15,19,.96));
  border: 1px solid color-mix(in srgb, var(--cc, var(--orange)) 38%, var(--line));
  box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 24px -8px color-mix(in srgb, var(--cc, var(--orange)) 65%, transparent), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  animation: heroFloat 7s ease-in-out infinite;
}
/* 顶部发光色条 */
.float-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, transparent, var(--cc, var(--orange)), transparent); box-shadow: 0 0 12px var(--cc, var(--orange)); }
/* 斜向扫光高光 */
.float-card::after { content: ""; position: absolute; top: -40%; left: -60%; width: 45%; height: 180%; transform: rotate(22deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent); animation: cardShine 6s ease-in-out infinite; }
.float-card .fc-ico { position: relative; font-size: 30px; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--cc, var(--orange)) 30%, transparent), transparent 70%); filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.float-card .fc-tag { font-size: 12px; font-weight: 800; color: var(--cc, var(--orange)); letter-spacing: 1.5px; text-shadow: 0 0 10px color-mix(in srgb, var(--cc, var(--orange)) 55%, transparent); }
.fc1 { top: 14%; left: 8%;  transform: rotate(-12deg); animation-delay: -.2s; }
.fc2 { top: 60%; left: 13%; transform: rotate(9deg);   animation-delay: -1.6s; }
.fc3 { top: 70%; right: 11%; transform: rotate(-8deg); animation-delay: -2.8s; }
.fc4 { top: 16%; right: 9%;  transform: rotate(11deg);  animation-delay: -3.6s; }
.fc5 { top: 40%; right: 4%;  transform: rotate(-6deg);  animation-delay: -4.8s; }
/* 扫光错峰，避免所有卡同时反光 */
.fc1::after { animation-delay: -.5s; } .fc2::after { animation-delay: -2s; } .fc3::after { animation-delay: -3.5s; } .fc4::after { animation-delay: -1.2s; } .fc5::after { animation-delay: -4.5s; }
@keyframes heroFloat { 50% { translate: 0 -16px; } }
@keyframes cardShine { 0% { left: -60%; } 55%, 100% { left: 150%; } }

/* 装饰篮球：大号半透明 emoji，缓慢自转 */
.hero-ball { position: absolute; left: 6%; bottom: 8%; font-size: 90px; opacity: .16; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); animation: heroSpin 26s linear infinite; }
@keyframes heroSpin { to { transform: rotate(360deg); } }

/* 上升的火花粒子（氛围动效） */
.hero-sparks { position: absolute; inset: 0; }
.hero-sparks i { position: absolute; bottom: -12px; left: var(--x, 50%); width: 6px; height: 6px; border-radius: 50%; background: var(--orange-2); box-shadow: 0 0 10px var(--orange-2); opacity: 0; animation: sparkRise var(--s, 10s) linear infinite; animation-delay: var(--d, 0s); }
.hero-sparks i:nth-child(3n) { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.hero-sparks i:nth-child(3n+1) { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes sparkRise { 0% { transform: translateY(0) scale(1); opacity: 0; } 12% { opacity: .85; } 85% { opacity: .5; } 100% { transform: translateY(-92vh) scale(.3); opacity: 0; } }

/* —— 内容层 —— */
.hero-content { position: relative; z-index: 1; width: min(1080px, 100%); display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }

.hero-left { display: flex; flex-direction: column; gap: 16px; }
.hero-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--orange-2); background: rgba(245,145,64,.1); border: 1px solid rgba(245,145,64,.35); padding: 6px 14px; border-radius: 999px; letter-spacing: .5px; }
.hb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); animation: heroBlink 2s ease-in-out infinite; }
@keyframes heroBlink { 50% { opacity: .35; } }

.hero-title { font-size: clamp(52px, 9vw, 104px); line-height: .92; font-weight: 900; letter-spacing: 2px; }
.hero-title { background: linear-gradient(115deg, #fff 0%, var(--orange-2) 35%, var(--orange) 55%, #fff 70%, var(--red) 100%); background-size: 220% auto; -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 24px rgba(232,119,46,.35)); animation: titleShimmer 7s linear infinite; }
.hero-title em { display: block; font-style: normal; background: linear-gradient(115deg, var(--blue) 0%, #7fb0ff 40%, #fff 60%, #7fb0ff 80%, var(--blue) 100%); background-size: 220% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: titleShimmer 7s linear infinite reverse; }
@keyframes titleShimmer { to { background-position: 220% center; } }
.hero-tagline { font-size: clamp(18px, 2.6vw, 26px); font-weight: 700; color: var(--ink); margin: 4px 0 0; }
.hero-sub { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.6; }

.hero-feats { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.hero-feats li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #cdd6df; }
.hero-feats li span { width: 30px; height: 30px; flex: none; display: grid; place-items: center; font-size: 15px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }

/* —— 入场卡（玻璃质感）—— */
.join-card { position: relative; display: grid; gap: 14px; background: linear-gradient(180deg, rgba(23,28,34,.82), rgba(15,18,22,.88)); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(12px); }
.join-card::before { content: ""; position: absolute; inset: 0; border-radius: 18px; padding: 1px; background: linear-gradient(135deg, var(--orange), transparent 40%, transparent 60%, var(--blue)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .5; pointer-events: none; }
.jc-head h2 { font-size: 22px; }
.jc-head p { color: var(--muted); margin: 8px 0 4px; font-size: 13px; line-height: 1.5; }
#joinForm label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
#joinForm input { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8,10,13,.6); color: var(--ink); font-size: 15px; transition: .15s; }
#joinForm input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,119,46,.18); }
#joinForm button[type="submit"] { position: relative; overflow: hidden; margin-top: 4px; background: linear-gradient(135deg, var(--orange-2), var(--orange)); border: none; color: #1a1208; font-weight: 800; padding: 13px 16px; border-radius: 10px; font-size: 16px; letter-spacing: .5px; box-shadow: 0 8px 20px rgba(232,119,46,.35); transition: .15s; animation: btnPulse 3s ease-in-out infinite; }
#joinForm button[type="submit"]::after { content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); animation: btnSheen 3.6s ease-in-out infinite; }
#joinForm button[type="submit"]:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(232,119,46,.5); animation-play-state: paused; }
@keyframes btnPulse { 0%, 100% { box-shadow: 0 8px 20px rgba(232,119,46,.35); } 50% { box-shadow: 0 10px 30px rgba(232,119,46,.62); } }
@keyframes btnSheen { 0% { left: -120%; } 45%, 100% { left: 160%; } }
.jc-hint { font-size: 11.5px; color: var(--muted); text-align: center; opacity: .8; }

/* 落地页响应式：窄屏堆叠（浮动卡牌保留，作为氛围背景） */
@media (max-width: 880px) {
  .hero-content { grid-template-columns: 1fr; gap: 28px; max-width: 460px; text-align: center; }
  .hero-left { align-items: center; }
  .hero-badge { align-self: center; }
  .hero-feats { text-align: left; }
}
@media (max-width: 560px) {
  .join-hero { padding: 26px 16px; min-height: 100dvh; }
  /* 浮动卡牌缩小贴四角，半透明置于内容下层做氛围，不遮挡文字 */
  .float-card { width: 60px; height: 80px; opacity: .5; gap: 6px; border-radius: 12px; }
  .float-card .fc-ico { font-size: 21px; width: 36px; height: 36px; }
  .float-card .fc-tag { font-size: 9px; letter-spacing: 1px; }
  .fc1 { top: 2%;  left: 2%;  right: auto; }
  .fc2 { top: 3%;  right: 2%; left: auto; }
  .fc3 { bottom: 3%; left: 2%;  top: auto; right: auto; }
  .fc4 { bottom: 2%; right: 2%; top: auto; }
  .fc5 { display: none; }
  .hero-ball { font-size: 56px; opacity: .12; left: 3%; bottom: 3%; }
  .hc-arc { display: none; }
  .hero-feats { gap: 8px; }
  .hero-feats li { font-size: 12.5px; }
  .join-card { padding: 22px; }
}
/* 尊重「减少动态效果」无障碍偏好：关闭所有 hero 动效 */
@media (prefers-reduced-motion: reduce) {
  .hero-glow, .hero-court, .float-card, .float-card::after, .hero-ball, .hb-dot,
  .hero-sparks i, .hero-title, .hero-title em, #joinForm button[type="submit"],
  #joinForm button[type="submit"]::after { animation: none; }
  .hero-sparks { display: none; }
}

.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); padding: 9px 16px; border-radius: 10px; font-size: 14px; transition: .15s; box-shadow: inset 0 1px 0 var(--hi); }
.btn:hover { border-color: var(--hover-line); background: #232b34; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary, #joinForm button { background: linear-gradient(180deg, var(--orange-2), var(--orange)); border: none; color: #1a1208; font-weight: 700; padding: 11px 16px; border-radius: 10px; font-size: 15px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 12px; }
/* 主题化下拉框：去掉原生外观，自绘橙色箭头，深色面板 + 清晰白字 */
.select-ui {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border: 1px solid var(--line); background-color: var(--panel-2); color: var(--ink);
  padding: 9px 30px 9px 14px; border-radius: 10px; font-size: 14px; font-family: inherit;
  cursor: pointer; transition: .15s; line-height: 1.2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23e8772e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select-ui.small { padding: 6px 28px 6px 12px; font-size: 12px; background-position: right 9px center; }
.select-ui:hover { border-color: var(--hover-line); }
.select-ui:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,119,46,.18); }
.select-ui option { background: var(--panel); color: var(--ink); }
.hidden { display: none !important; }
/* 仅手机断点出现的控件（抽屉把手、战报跳转按钮）：桌面隐藏，820 媒体查询内放出 */
.mobile-only { display: none; }

.game { padding: 14px 18px 0; }
.scoreboard { position: relative; display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 12px; align-items: center; background: linear-gradient(180deg, #11161b, #0d1115); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; box-shadow: var(--shadow); }
/* 渐变描边点睛（红→蓝双队色），复用 join-card 的 mask 描边手法，强化「主屏」地位 */
.scoreboard::before { content: ""; position: absolute; inset: 0; border-radius: var(--radius); padding: 1px; background: linear-gradient(120deg, color-mix(in srgb, var(--red) 60%, transparent), transparent 38%, transparent 62%, color-mix(in srgb, var(--blue) 60%, transparent)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .6; pointer-events: none; }
.team-score { display: grid; justify-items: center; gap: 2px; padding: 6px 10px; border-radius: 12px; }
.team-score.red { background: linear-gradient(180deg, transparent, var(--red-soft)); }
.team-score.blue { background: linear-gradient(180deg, transparent, var(--blue-soft)); }
.team-score .tlabel { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
.team-score.red .tlabel { color: var(--red); }
.team-score.blue .tlabel { color: var(--blue); }
.team-score strong { font-size: 46px; font-variant-numeric: tabular-nums; line-height: 1; }
.team-score .series { font-size: 11px; color: var(--muted); }
.center-info { text-align: center; display: grid; gap: 5px; justify-items: center; }
/* 节/回合 + 球权 是中列视觉重心：标题用中性 ink，不再抢橙 */
.phase-title { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: .5px; }
.clock-row { display: flex; gap: 12px; justify-content: center; align-items: center; }
#roundInfo { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* shot-clock：原 #000 死黑块改为带暖调的深色，融进比分牌；命中数字保留橙强调 */
.shot-clock { font-size: 16px; font-weight: 800; color: var(--accent); background: #160d06; padding: 3px 10px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.shot-clock.warn { color: var(--red); border-color: var(--red); background: #1a0a09; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.poss-info { font-size: 12px; color: var(--muted); min-height: 16px; }

.layout { display: grid; grid-template-columns: 240px 1fr 280px; gap: 12px; margin-top: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h3 { font-size: 14px; color: var(--muted); letter-spacing: 1px; }
.head-btns { display: flex; gap: 6px; }
.side { display: flex; flex-direction: column; max-height: 64vh; }
.players { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.player { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.player.red { border-left: 3px solid var(--red); }
.player.blue { border-left: 3px solid var(--blue); }
.player .pname { flex: 1; font-weight: 600; }
.player .ptag { font-size: 11px; color: var(--muted); }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--line); }
.badge.ok { background: var(--good); color: #06210f; }
.badge.off { background: #4a3030; color: #f3b4b0; }
.team-picker { margin-top: 10px; display: grid; gap: 6px; }
.team-picker .row { display: flex; gap: 6px; }
.team-picker .row .btn { flex: 1; }
.btn.red-btn { border-color: var(--red); } .btn.blue-btn { border-color: var(--blue); }
.team-picker small { color: var(--muted); font-size: 11px; }

/* ---------- 球场 ---------- */
.court-wrap { display: flex; flex-direction: column; }
.court {
  position: relative; height: 360px; border-radius: 12px; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.12)),
    repeating-linear-gradient(0deg, #cf9a55, #cf9a55 22px, #c79150 22px, #c79150 44px);
  border: 3px solid #6d4a22; box-shadow: inset 0 0 60px rgba(0,0,0,.4);
}
.zone-bg { position: absolute; top: 0; bottom: 0; width: 33.333%; }
.zone-bg.arc { left: 0; }
.zone-bg.mid { left: 33.333%; }
.zone-bg.paint { left: 66.666%; }
.zlabel { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: #3a2810; font-weight: 700; text-shadow: 0 1px 0 rgba(255,255,255,.3); z-index: 1; }

/* —— 半场场地线（篮筐在右侧）——
   所有线条按场地宽度等比缩放：圆形用 width:% + aspect-ratio:1 保持正圆，
   位置用 % 锚定到与 token 区域（arc 16% / mid 50% / paint 78%，分割线 33.3%/66.6%，
   篮筐 88%）一致的坐标，故窗口放大时三分弧/油漆区随之等比放大、边界保持对齐。 */
.court-lines { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cl { position: absolute; border-color: rgba(255,255,255,.55); }
/* 三分弧：以篮筐(88%)为圆心的大圆，弧顶落在 arc/mid 分割线(33.3%)外一点点(~30%)，仅左侧弧在场内可见 */
.cl-three { top: 50%; right: -46%; width: 116%; aspect-ratio: 1; transform: translateY(-50%); border: 3px solid rgba(255,255,255,.5); border-radius: 50%; }
/* 禁区（油漆区）矩形：贴右侧底线，左缘 72% 完整落在篮下区(66.6%~100%)内 */
.cl-key { top: 50%; right: 0; width: 28%; height: 48%; transform: translateY(-50%); border: 3px solid rgba(255,255,255,.45); border-right: none; background: rgba(232,119,46,.14); }
/* 罚球圈：圆心在禁区左缘(罚球线 72%) */
.cl-ft { top: 50%; left: 72%; width: 13%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.45); border-radius: 50%; }
/* 中圈：场地左缘（中线）的半圆 */
.cl-center { top: 50%; left: 0; width: 12%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.4); border-radius: 50%; }
/* 中线（左缘） */
.cl-mid { left: 0; top: 0; bottom: 0; border-left: 3px solid rgba(255,255,255,.35); }

/* 真实篮筐：背板 + 篮圈 + 网 */
.hoop { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 40px; height: 90px; z-index: 1; }
.backboard { position: absolute; right: 0; top: 6px; width: 8px; height: 78px; background: linear-gradient(180deg, #fff, #d8d8d8); border: 1px solid #999; border-radius: 2px; box-shadow: 0 0 8px rgba(0,0,0,.3); }
.backboard::after { content: ""; position: absolute; right: 2px; top: 26px; width: 5px; height: 26px; border: 2px solid var(--orange); }
.rim { position: absolute; right: 8px; top: 44px; width: 26px; height: 5px; background: var(--orange); border-radius: 3px; box-shadow: 0 0 6px var(--orange); }
.net { position: absolute; right: 9px; top: 48px; width: 24px; height: 20px; border-left: 2px solid rgba(255,255,255,.6); border-right: 2px solid rgba(255,255,255,.6);
  background: repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(255,255,255,.45) 4px, rgba(255,255,255,.45) 5px); clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%); }

.token-layer { position: absolute; inset: 0; z-index: 2; }
.ptoken { position: absolute; transform: translate(-50%, -50%); transition: left .55s cubic-bezier(.4,1.2,.5,1), top .55s cubic-bezier(.4,1.2,.5,1); z-index: 2; }
.ptoken .body { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 7px; border-radius: 10px; background: rgba(15,18,22,.88); border: 2px solid var(--line); box-shadow: var(--shadow); min-width: 52px; }
.ptoken.red .body { border-color: var(--red); }
.ptoken.blue .body { border-color: var(--blue); }
.ptoken.me .body { box-shadow: 0 0 0 2px var(--orange-2), var(--shadow); }
.ptoken.active .body { animation: tokpop .4s; }
@keyframes tokpop { 50% { transform: scale(1.12); } }
.ptoken .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.ptoken.red .num { background: var(--red); } .ptoken.blue .num { background: var(--blue); }
.ptoken .nm { font-size: 11px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptoken .bk { position: absolute; top: -10px; right: -10px; font-size: 15px; }
.ptoken .chips { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; margin-top: 2px; max-width: 86px; }
/* chip 背景/文字色由内联 style 注入（真源 cards.mjs 的 STATE_STYLE，经 config.stateStyle 下发） */
.chip { font-size: 9px; padding: 0 4px; border-radius: 5px; background: #44505d; color: var(--ink); cursor: help; white-space: nowrap; }

/* ============================ 表情气泡 + 轮盘 ============================ */
/* 表情层：与 token 层同坐标系(inset:0)，但层本身不挡操作；气泡自身可点（重播）。z-index 在 token 之上、命中条之下 */
.emote-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
/* 白色对话气泡，从 token 向右上角弹出：定位用 token 的 left/top%（token 中心），再用 transform 把整块推到中心的右上方。
   左下角为尖角（其余三角圆弧），本身即对话气泡的指向，无需额外小三角；缩回(scale)与弹出均以左下角为原点，朝 token 收/放。 */
.emote-bubble {
  position: absolute; pointer-events: auto; cursor: pointer;
  transform: translate(10px, calc(-100% - 8px));
  background: #fff; border-radius: 12px 12px 12px 3px; padding: 4px;
  box-shadow: 0 3px 9px rgba(0,0,0,.35); border: 1.5px solid rgba(0,0,0,.08);
  transform-origin: bottom left; transition: opacity .45s ease, scale .45s ease;
  scale: 1; opacity: 1; line-height: 0;
}
.emote-bubble img { width: 46px; height: 46px; object-fit: contain; display: block; border-radius: 8px; }
/* 入场弹出（每次发新表情触发一次；点击重播也会复用） */
.emote-bubble.pop { animation: emote-pop .34s cubic-bezier(.2,1.3,.45,1); }
@keyframes emote-pop { 0% { scale: .3; opacity: 0; } 60% { scale: 1.12; } 100% { scale: 1; opacity: 1; } }
/* 停留几秒后缩回：缩小 + 降透明度，但不完全隐藏，仍停在原位，点击可重新展开 */
.emote-bubble.collapsed { scale: .5; opacity: .45; }
.emote-bubble.collapsed:hover { opacity: .7; }

/* 入口按钮：紧贴球场左下角的浮动圆角方钮（自绘 SVG 笑脸，跨平台一致，不用系统 emoji） */
.emote-btn {
  position: absolute; left: 5px; bottom: 5px; z-index: 6;
  width: 36px; height: 36px; border-radius: 11px; padding: 0;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(155deg, rgba(48,56,67,.92), rgba(22,26,32,.94));
  color: #cdd6e0; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.42); backdrop-filter: blur(3px);
  transition: transform .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.emote-btn svg { width: 22px; height: 22px; display: block; }
.emote-btn:hover { transform: translateY(-1px); color: var(--orange-2); border-color: var(--orange-2); box-shadow: 0 6px 16px rgba(0,0,0,.52); }
.emote-btn:active { transform: scale(.94); }

/* 轮盘浮层：居中圆盘 + 半透明遮罩（点遮罩关闭） */
.emote-wheel-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.emote-wheel-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(1px); }
.emote-wheel-disc {
  position: relative; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(38,46,56,.97), rgba(18,22,28,.97));
  border: 2px solid var(--line); box-shadow: 0 14px 40px rgba(0,0,0,.5);
  animation: emote-wheel-in .2s ease;
}
@keyframes emote-wheel-in { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 每个格子：圆盘中心为原点，由内联 transform 推到环上各等角位置 */
.emote-slot {
  position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  background: #fff; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 3px 10px rgba(0,0,0,.4);
  transition: filter .12s ease;
}
.emote-slot:hover { filter: brightness(1.06); z-index: 1; }
.emote-slot:active { filter: brightness(.92); }
.emote-slot img { width: 48px; height: 48px; object-fit: contain; display: block; pointer-events: none; }
.emote-slot.clear { background: #2a323c; border-color: var(--line); }
.emote-slot.clear .emote-clear { color: #e2483f; font-size: 26px; font-weight: 800; }

/* 飞行中的篮球：与 token 右上角 .bk 同款 🏀 emoji，仅在传球/投篮/篮板轨迹动画时出现。
   z-index 高于命中条(7)/烟花(8)。盒子比字形略宽 + text-align 居中 + overflow:visible，
   避免 Windows Segoe UI Emoji 偏宽/右移时被容器裁掉右半边。 */
.ball { position: absolute; left: 50%; top: 50%; z-index: 9; width: 26px; height: 26px; line-height: 26px; text-align: center; font-size: 18px; overflow: visible; transform: translate(-50%, -50%); filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); pointer-events: none; transition: left .6s ease, top .6s ease; }

/* 投篮命中率进度条 */
.shot-meter { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: 72%; z-index: 7; background: rgba(8,10,13,.92); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
.meter-title { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 6px; }
.meter-track { position: relative; height: 16px; background: #20262e; border-radius: 8px; overflow: hidden; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, var(--good), #7ee0a6); transition: width .9s linear; }
.meter-fill.miss { background: linear-gradient(90deg, #e2483f, #f08079); }
.meter-marker { position: absolute; top: -3px; bottom: -3px; width: 3px; background: #fff; box-shadow: 0 0 5px #fff; z-index: 2; }
.meter-marker::after { content: "命中线"; position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: #fff; white-space: nowrap; }
.meter-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; }
#meterRoll { font-weight: 800; color: var(--orange-2); }
#meterAcc { color: var(--muted); }

.fireworks { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; opacity: 0; }
@keyframes burst { 0% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); } }

.step-caption { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 7; background: rgba(8,10,13,.9); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-size: 13px; max-width: 90%; text-align: center; }
.step-caption .cap-card { color: var(--orange-2); font-weight: 700; text-decoration: underline; }

.court-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.replay-info { font-size: 12px; color: var(--muted); }
.speed-ctrl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: auto; }
.speed-ctrl input[type=range] { width: 120px; accent-color: var(--orange); }
#speedVal { min-width: 38px; color: var(--orange-2); }

.game-progress { margin-top: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.gp-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.gp-track { height: 8px; background: #20262e; border-radius: 5px; overflow: hidden; }
.gp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); transition: width .3s; }

/* 篮板数据面板 */
.rebound-panel { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: 72%; z-index: 7; background: rgba(8,10,13,.94); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
.rebound-panel .rb-title { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 8px; }
.rebound-panel .rb-rows { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.rebound-panel .rb-row { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.rebound-panel .rb-row.red { border-left: 3px solid var(--red); }
.rebound-panel .rb-row.blue { border-left: 3px solid var(--blue); }
.rebound-panel .rb-row.win { background: var(--good); color: #06210f; font-weight: 700; }
.rebound-panel .rb-foot { text-align: center; font-size: 11px; color: var(--orange-2); margin-top: 8px; }

/* 卡牌悬停详情浮层 */
.card-tip { position: fixed; z-index: 120; max-width: min(280px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; background: #0b0e12; border: 1px solid var(--orange); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); pointer-events: none; }
.card-tip .tip-name { font-weight: 700; color: var(--orange-2); margin-bottom: 4px; }
.card-tip .tip-cat { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.card-tip .tip-detail { font-size: 12px; color: var(--ink); line-height: 1.5; }
.result-banner { margin-top: 10px; padding: 10px 14px; border-radius: 10px; text-align: center; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); }
.result-banner.score { background: linear-gradient(90deg, var(--orange), var(--orange-2)); color: #1a1208; }
.result-banner.miss { color: var(--muted); }

.log { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; font-size: 12px; max-height: 360px; } /* 不超过场地图高度（.court 360px） */
.log-item { padding: 5px 8px; background: var(--panel-2); border-radius: 8px; color: var(--muted); }
.log-item time { color: #6f7c8a; margin-right: 6px; font-size: 11px; font-variant-numeric: tabular-nums; }
/* 所属卡牌名：下划线 + 卡牌类型色（颜色内联），悬停弹卡牌详情 */
.log-card { text-decoration: underline; font-weight: 700; cursor: help; }
/* 分隔行：暗黄色横线（每张牌 -------- / 每回合 ========） */
.log-sep { background: transparent; padding: 1px 8px; text-align: center; color: #9a7d3a; letter-spacing: 2px; font-weight: 700; }

/* ---------- 行动栏 ---------- */
.action-bar { margin: 12px 0 18px; }
/* 手牌区背景压到更暗（--bg），让维持 panel-2 起步的卡牌从面板上「浮」出来 */
.hand-area { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.hand-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hand-hint { font-size: 13px; color: var(--muted); }
.hand-actions { display: flex; gap: 8px; align-items: center; }
.sel-count { font-size: 13px; color: var(--orange-2); font-weight: 700; }
.hand-row { display: flex; align-items: stretch; gap: 10px; }
.hand { display: flex; gap: 10px; flex-wrap: wrap; min-height: 120px; }
.blank-sep { width: 1px; background: var(--line); margin: 0 4px; }
.card { position: relative; width: 104px; min-height: 120px; border-radius: 12px; padding: 10px; background: linear-gradient(180deg, var(--panel-2), #141a20); border: 1px solid var(--line); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; user-select: none; display: flex; flex-direction: column; box-shadow: var(--shadow); }
/* hover：上浮保留，描边用本牌分类色的淡色而非固定橙 */
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cat, var(--accent)) 55%, var(--line)); }
/* selected：分类同色辉光（呼应 hero float-card），不再固定橙 */
.card.selected { border-color: var(--cat, var(--accent)); box-shadow: 0 0 0 2px var(--cat, var(--accent)), 0 12px 28px -8px color-mix(in srgb, var(--cat, var(--accent)) 60%, transparent); transform: translateY(-6px); }
.card.disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.card .cname { font-weight: 800; font-size: 14px; margin-bottom: 6px; color: var(--ink); letter-spacing: .3px; }
/* 分类做成同色 pill 标签（带淡底 + 描边），比纯文字更「卡牌」、更有设计感 */
.card .ccat { align-self: flex-start; font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--cat, var(--muted));
  background: color-mix(in srgb, var(--cat, var(--muted)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, var(--muted)) 42%, transparent);
  padding: 1px 7px; border-radius: 999px; margin-bottom: 7px; }
.card .cdesc { font-size: 10.5px; color: var(--muted); line-height: 1.35; flex: 1; }
.card .ctarget { font-size: 10px; color: var(--good); margin-top: 4px; font-weight: 600; }
/* 文案层置于玻璃高光之上，保证可读性 */
.card .cname, .card .ccat, .card .cdesc, .card .ctarget { position: relative; z-index: 1; }
/* 顺位徽标 .corder 是回合内真焦点，保留橙 */
.card .corder { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #1a1208; font-weight: 800; display: grid; place-items: center; font-size: 12px; box-shadow: 0 2px 8px -2px var(--accent); }
/* 卡牌顶部分类色条：颜色来自 cards.mjs 的 CAT_DB，经 config 下发，由内联 --cat 变量注入。
   再叠一层极淡同色径向光渗进卡面 + 顶部内高光，让分类色「上脸」、卡牌更像物件 */
.card[data-cat] {
  border: 1px solid color-mix(in srgb, var(--cat) 26%, var(--line));
  border-top: 3px solid var(--cat, var(--line));
  background:
    radial-gradient(130% 58% at 50% -10%, color-mix(in srgb, var(--cat) 26%, transparent), transparent 60%),
    linear-gradient(180deg, var(--panel-2), #11161c);
}
/* 顶部斜向玻璃高光（呼应 hero 漂浮卡），仅覆盖上半部、不压暗描述文案 */
.card[data-cat]:not(.blank):not(.fixed)::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 48%;
  border-radius: 11px 11px 40% 40%;
  background: linear-gradient(158deg, rgba(255,255,255,.13), rgba(255,255,255,.03) 40%, transparent 72%);
  pointer-events: none; z-index: 0;
}
/* 空白牌后退：更「虚」（低透明 + 无投影 + hover 不抬升），让真正手牌更突出 */
.card.blank { background: repeating-linear-gradient(45deg, #161b21, #161b21 6px, #12161b 6px, #12161b 12px); border-style: dashed; opacity: .55; box-shadow: none; }
.card.blank:hover { transform: none; opacity: .85; border-color: var(--hover-line); }
/* 空白牌的 --cat 是近隐形的灰，选中辉光看不见 —— 选中时改用 accent 实底 + 实线描边 + 暖色辉光，
   并恢复实体感与上浮，让「已选」一目了然 */
.card.blank.selected {
  opacity: 1; transform: translateY(-6px); border-style: solid; border-color: var(--accent);
  background: repeating-linear-gradient(45deg, #2a2012, #2a2012 6px, #221a0e 6px, #221a0e 12px);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 28px -8px rgba(232,119,46,.55);
}
.card.blank.selected .cname { color: var(--accent-2); }
.card.blank .cname { color: var(--muted); }
.card.blank .ccat { color: var(--muted); background: transparent; border-color: var(--line); }
/* 固定免费牌：虚线纹路（同空白）+ 保留分类主体色，右上角“免费”角标（中性化，不抢橙） */
.card.fixed { background: repeating-linear-gradient(45deg, #1a2027, #1a2027 6px, #161b21 6px, #161b21 12px); border-style: dashed; }
.card.fixed::before { content: "免费"; position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 600; color: #e3e9ef; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 5px; padding: 1px 4px; }
.card:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }
/* 卡牌右下角 ⓘ 说明按钮：点按弹出详情（触屏发现性优于隐式长按） */
.card-info { position: absolute; bottom: 4px; right: 4px; width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%; background: rgba(255,255,255,.08); color: var(--muted); font-size: 12px; line-height: 1; display: grid; place-items: center; cursor: help; opacity: .7; }
.card-info:hover { opacity: 1; background: rgba(255,255,255,.16); color: var(--ink); }
/* ⓘ 视觉仍是 18px，但用透明 ::after 把可点区域外扩到 ~38px，触屏不再误点到卡牌本体
   （点进此区只走 .card-info 的 click→弹 tip，不触发选牌/选目标浮窗） */
.card-info::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
/* 「+ 空白」按钮：外观近似一张虚线占位卡，按需添加空白牌 */
.blank-add { width: 104px; min-height: 120px; border-radius: 12px; border: 1px dashed var(--line); background: repeating-linear-gradient(45deg, #161b21, #161b21 6px, #12161b 6px, #12161b 12px); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: .12s; opacity: .7; }
.blank-add:hover { border-color: var(--hover-line); color: var(--ink); transform: translateY(-3px); opacity: 1; }
.blank-add:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }

.draft-area { margin-bottom: 12px; text-align: center; }
/* 构筑标题：中性 ink + 一条 accent 细下划线点睛，不再整行喊橙 */
.draft-title { display: inline-block; font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 auto 12px; padding-bottom: 5px; text-align: center; border-bottom: 2px solid var(--accent); }
.bundles { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.bundle { width: 200px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); transition: .15s; box-shadow: var(--shadow); }
.bundle:hover { border-color: var(--hover-line); transform: translateY(-2px); }
.bundle .btheme { font-weight: 700; color: var(--ink); margin-bottom: 8px; text-align: center; }
.bundle .bcards { display: grid; gap: 6px; margin-bottom: 10px; }
.bundle .bcard { font-size: 12px; padding: 6px 8px; background: var(--panel-2); border-radius: 8px; }
.bundle .bcard small { color: var(--muted); display: block; font-size: 10px; }
.bundle .btn { width: 100%; }
.bundle.picked { border-color: var(--good); opacity: .7; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(420px, 92vw); box-shadow: var(--shadow); }
.modal-box h3 { margin-bottom: 14px; }
.modal-body { display: grid; gap: 8px; margin-bottom: 14px; }
.modal-body .btn { width: 100%; text-align: left; }
.modal-box .btn:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }
/* 浮窗底部当前出牌预览：复用卡牌类型色（--cat 内联注入），顶部色条 + 同色描边，与手牌一致 */
.modal-card { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--cat, var(--line)) 30%, var(--line));
  border-top: 3px solid var(--cat, var(--line));
  background:
    radial-gradient(130% 60% at 50% -10%, color-mix(in srgb, var(--cat) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--panel-2), #141a20); }
.modal-card .mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.modal-card .mc-name { font-weight: 800; font-size: 14px; color: var(--ink); letter-spacing: .3px; }
.modal-card .mc-cat { font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--cat, var(--muted));
  background: color-mix(in srgb, var(--cat, var(--muted)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, var(--muted)) 42%, transparent);
  border-radius: 5px; padding: 1px 6px; }
.modal-card .mc-desc { font-size: 12px; color: var(--ink); line-height: 1.5; }

/* 错误提示 toast（常驻 live region，由 .hidden 控制显隐） */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 13px; }

/* ---------- 提交倒计时（提交按钮左侧的红色醒目数字） ---------- */
.countdown { font-size: 20px; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; text-shadow: 0 0 8px rgba(226,72,63,.5); letter-spacing: .5px; transform-origin: right center; display: inline-block; }
.countdown.urgent { text-shadow: 0 0 12px rgba(226,72,63,.9); }
/* 最后十秒：每秒由 JS 重新挂上 .bump 触发一次“跳大→复位”，配合 tick 音效警示 */
.countdown.bump { animation: countbump .9s ease-out; }
@keyframes countbump { 0% { transform: scale(1); } 35% { transform: scale(1.7); } 100% { transform: scale(1); } }

/* ---------- 数据统计浮窗 ---------- */
.stats-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(720px, 94vw); max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow); }
.stats-box h3 { margin-bottom: 16px; color: var(--orange-2); font-size: 18px; }
.stats-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 15px; line-height: 1; display: grid; place-items: center; }
.stats-close:hover { border-color: var(--red); color: var(--red); }
/* 移出玩家/机器人 X 图标按钮（房主在席位行内） */
.kick-x { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; line-height: 1; display: grid; place-items: center; cursor: pointer; transition: .15s; padding: 0; }
.kick-x:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
/* 被踢出房间提示弹窗 */
.kick-box { text-align: center; }
.kick-msg { margin: 6px 0 18px; font-size: 16px; font-weight: 600; }
.kick-ok { background: var(--red); border: none; color: #fff; font-weight: 700; padding: 9px 30px; }
.kick-ok:hover { filter: brightness(1.1); }
.stats-body { display: flex; flex-direction: column; gap: 16px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table th, .stats-table td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stats-table th { color: var(--muted); font-weight: 600; background: var(--panel-2); }
.stats-table .pcol { text-align: left; min-width: 96px; }
.stats-table thead .pcol { font-size: 14px; letter-spacing: 1px; }
.stats-table.red thead .pcol { color: var(--red); }
.stats-table.blue thead .pcol { color: var(--blue); }
.stats-table thead .pcol b { font-size: 17px; }
.stats-table .empty { color: var(--muted); }
.stats-table .mvp-row { background: rgba(255,209,102,.08); }
.mvp-tag { display: inline-block; background: #ffd166; color: #3a2800; font-weight: 800; font-size: 10px; padding: 1px 5px; border-radius: 5px; margin-right: 6px; }
.mvp-name { color: #ffd166; font-weight: 700; }

/* ---------- 3 选 1 卡牌：按 cat 上边框色 ---------- */
.bundle .bcard[data-cat] { border: 1px solid var(--cat, var(--line)); border-left-width: 3px; }

/* 过渡档（窄桌面 / 平板）：三栏压成单列，仍是桌面式卡牌行 */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { max-height: none; }
}

/* ============================================================
   手机方案（CSS 宽 ≤ 820px，含 PC 竖屏/窄窗口、系统缩放放大后的半屏）
   纯表现层：分阶段重排 + scoreboard 吸顶 + 卡牌上拉抽屉 + 触屏控件
   ============================================================ */
@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }

  /* —— 列布局：把 .layout 摊平，使席位/球场/战报与 scoreboard、卡牌区同级，可用 order 跨层排序 —— */
  .game { display: flex; flex-direction: column; padding: 10px 10px 18px; }
  .layout { display: contents; }

  /* lobby 默认顺序 = DOM 顺序：scoreboard → 席位 → 球场 → 战报（无需 order；卡牌区此时隐藏） */
  /* 出牌/构筑阶段（in-action = play / openingDraft / draft）统一重排，所有人含观战都生效：
     scoreboard(吸顶) → 球场 → 卡牌或构筑区 → 战报 → 席位（actionBar 观战时 display:none，order 无副作用） */
  .game.in-action .court-wrap { order: 1; }
  .game.in-action #actionBar  { order: 2; }
  .game.in-action #logPanel   { order: 3; }
  .game.in-action #seatPanel  { order: 4; }

  /* 结算/回放表演：末回合结算时已切到 gameOver/seriesOver（非 in-action），重排会丢失、球场退回到
     席位下方，导致跳转后看不到球场。replay-focus 在表演期间强制沿用「球场置顶」排序，与
     focusCourtForReplay 的「收起抽屉 + 跳比分区」配合，保证末回合结算动画完整可见。 */
  .game.replay-focus .court-wrap { order: 1; }
  .game.replay-focus #actionBar  { order: 2; }
  .game.replay-focus #logPanel   { order: 3; }
  .game.replay-focus #seatPanel  { order: 4; }

  /* scoreboard 吸顶 + 高度压到 ~75%（宽度仍撑满；字号/内距同比缩小） */
  .scoreboard { position: sticky; top: 0; z-index: 20; padding: 7px 12px; gap: 8px; }
  .team-score { padding: 3px 8px; gap: 0; }
  .team-score strong { font-size: 28px; }
  .team-score .tlabel { font-size: 11px; }
  .team-score .series { font-size: 10px; }
  .phase-title { font-size: 13px; }
  .clock-row { margin-top: 3px; gap: 10px; }
  .shot-clock { font-size: 14px; padding: 2px 8px; }
  .poss-info { margin-top: 3px; font-size: 11px; min-height: 0; }
  .center-info { min-width: 0; }

  /* 球场高度压到 ~75%（宽度撑满；token 按 % 定位会随之重新分布） */
  .court { height: 260px; }
  /* 场上玩家 token 整体缩小 ~78%（保持 translate 居中定位，仅叠加 scale） */
  .ptoken { transform: translate(-50%, -50%) scale(0.78); }
  /* 表情：手机端气泡与轮盘整体收小 */
  .emote-bubble img { width: 36px; height: 36px; }
  .emote-btn { width: 32px; height: 32px; border-radius: 9px; left: 4px; bottom: 4px; }
  .emote-btn svg { width: 19px; height: 19px; }
  .emote-wheel-disc { width: 210px; height: 210px; }
  .emote-slot { width: 52px; height: 52px; }
  .emote-slot img { width: 42px; height: 42px; }

  .side { max-height: none; }
  #logPanel .log { max-height: 56vh; }

  /* —— 卡牌上拉抽屉（#actionBar）：折叠 = 在流内位于球场下方（原位置）；展开 = 固定覆盖球场上拉 —— */
  #actionBar.action-bar {
    margin: 0; display: none; flex-direction: column; min-height: 0;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  }
  /* 仅在需要出牌/构筑的阶段显示抽屉，避免 lobby 出现悬空把手 */
  .game.show-drawer #actionBar.action-bar { display: flex; }

  /* 展开态：脱离文档流，固定底部上拉，覆盖球场，最高占满全屏 */
  #actionBar.action-bar.drawer-open {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 14px 14px 0 0;
    max-height: 100dvh; box-shadow: 0 -8px 24px rgba(0,0,0,.45);
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  /* 把手：常驻顶部居中（展开/折叠都显示） */
  .drawer-toggle {
    flex: none; align-self: center; margin: 6px auto 4px; width: 56px; height: 22px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
    color: var(--orange-2); font-size: 12px; line-height: 1; display: grid; place-items: center;
  }
  .drawer-toggle:hover { border-color: var(--hover-line); }

  /* 卡牌/构筑内容区：折叠在流内自然高度（随整页滚动）；展开时占满抽屉剩余高度并内部滚动 */
  #handArea { padding: 8px 10px; border: none; background: transparent; min-height: 0; }
  #actionBar.drawer-open #handArea,
  #actionBar.drawer-open #draftArea {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  }
  /* 手牌竖向铺开更利于触屏滚动 */
  .hand-row { flex-direction: column; }
  .blank-sep { width: auto; height: 1px; margin: 4px 0; }

  /* 手牌区卡牌缩小到 ~80%（手机端尺寸更合适；构筑 3 选 1 的 .bcard 不受影响） */
  .hand { min-height: 0; gap: 8px; }
  .card { width: 84px; min-height: 96px; padding: 8px; border-radius: 10px; }
  .card .cname { font-size: 12px; margin-bottom: 3px; }
  .card .ccat { font-size: 9px; margin-bottom: 4px; }
  .card .cdesc { font-size: 9px; line-height: 1.3; }
  .card .ctarget { font-size: 9px; margin-top: 3px; }
  .card .corder { width: 18px; height: 18px; font-size: 11px; top: -6px; right: -6px; }
  .card.fixed::before { font-size: 8px; }
  .blank-add { width: 84px; min-height: 96px; border-radius: 10px; font-size: 12px; }

  /* —— 球场浮层窄屏自适应：260px 高的移动球场上，命中条/篮板面板/字幕收窄缩小，减少与 token 互叠 —— */
  .shot-meter, .rebound-panel { width: 92%; padding: 7px 10px; bottom: 8px; border-radius: 8px; }
  .meter-title { font-size: 11px; margin-bottom: 4px; }
  .meter-track { height: 13px; }
  .meter-labels { font-size: 11px; margin-top: 4px; }
  .meter-marker::after { font-size: 8px; top: -14px; } /* 命中线标签缩小，降低与刻度数字重叠 */
  .rebound-panel .rb-title { margin-bottom: 6px; }
  .rebound-panel .rb-row { font-size: 10px; padding: 2px 6px; }
  .rebound-panel .rb-foot { margin-top: 6px; }
  .step-caption { font-size: 11px; padding: 5px 10px; top: 8px; max-width: 94%; }
}
/* 极窄屏（≤480px）：命中线文字与刻度极易重叠，直接隐去文字标签，仅保留白色刻度线 */
@media (max-width: 480px) {
  .meter-marker::after { display: none; }
}
