/* ================================================================
   卡牌大乱斗 · 深色奇幻风样式
   布局分三块：顶栏（回合/法力/结束回合）、对局桌（玩家血条）、
   底部（战斗日志 + 手牌区）。全部使用 flex/grid，无需任何框架。
   ================================================================ */

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

:root {
  --bg: #141a2b;
  --bg2: #1d2740;
  --panel: #222d4a;
  --panel2: #2b3a5f;
  --line: #3a4a78;
  --text: #e8ecf7;
  --dim: #93a0c4;
  --gold: #f5c542;
  --red: #e05252;
  --green: #4fc07a;
  --blue: #5aa7ff;
  --rare: #c084fc;
  --rareBg: #3b2a5e;
}

html, body { height: 100%; }
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #23315a 0%, var(--bg) 55%);
  color: var(--text);
  overflow: hidden;
}

.view { height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---------------- 通用控件 ---------------- */
.btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: transform .06s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #f0a13c, #d1495b); border-color: #ffd9a0; font-weight: 700; }
.btn.big { padding: 14px 34px; font-size: 17px; }
.btn.ghost { background: transparent; }
.btn.mini { padding: 3px 10px; font-size: 12px; border-radius: 6px; }
.link { background: none; border: none; color: var(--blue); cursor: pointer; text-decoration: underline; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input, select {
  background: #10162a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); }

/* ---------------- 大厅 ---------------- */
#view-lobby { overflow-y: auto; align-items: center; gap: 16px; padding: 26px 16px 60px; }
.hero { text-align: center; margin-bottom: 4px; }
.hero h1 { font-size: 40px; letter-spacing: 2px; }
.hero p { color: var(--dim); margin-top: 6px; }
.card-box {
  width: min(560px, 100%);
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
}
.card-box h2 { font-size: 15px; color: var(--gold); margin-bottom: 12px; }
.hint { color: var(--dim); font-size: 12.5px; margin-top: 10px; line-height: 1.6; }
.room-code { font-size: 17px; margin-bottom: 10px; }
.room-code b { color: var(--gold); letter-spacing: 3px; font-size: 22px; }
.lobby-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 6px; }
.lobby-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 10px;
}
.lobby-row .tag { font-size: 12px; padding: 1px 8px; border-radius: 8px; }
.lobby-row .host { background: var(--gold); color: #333; }
.lobby-row .you { background: var(--blue); color: #0c1a33; }
.lobby-row .bot { background: #7a5bd6; color: #fff; }
.foot { color: var(--dim); font-size: 12px; text-align: center; line-height: 1.9; margin-top: 8px; }

/* ---------------- 对局：顶栏 ---------------- */
#topBar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(10, 14, 26, .72);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
#battleTitle { font-weight: 800; }
.turn-hint { color: var(--dim); font-size: 13px; }
.turn-hint .hot { color: var(--gold); font-weight: 700; }
.tb-right { display: flex; gap: 8px; align-items: center; }
.chip {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 14px; font-size: 14px;
}

/* ---------------- 对局桌 ---------------- */
#table {
  flex: 1 1 auto;
  display: grid;
  gap: 12px;
  padding: 16px;
  align-content: center;
  min-height: 0;
}
/* 玩家数不同时自动排布：4 人 -> 2x2 / 5 人 -> 上 2 下 3 */
#table[data-n="4"] { grid-template-columns: repeat(2, minmax(240px, 420px)); }
#table[data-n="5"] { grid-template-columns: repeat(3, minmax(200px, 360px)); }
#table[data-n="3"], #table[data-n="2"] { grid-template-columns: repeat(2, minmax(240px, 420px)); }
#table[data-n="1"] { grid-template-columns: 1fr; }

.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel), #1a2340);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  transition: box-shadow .2s, border-color .2s, opacity .2s;
}
.panel.turn-now { border-color: var(--gold); box-shadow: 0 0 14px rgba(245, 197, 66, .45); }
.panel.you-self { border-color: var(--blue); }
.panel.dead { opacity: .5; filter: grayscale(.8); }
.panel .p-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.panel .tag { font-size: 11px; padding: 1px 7px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); }
.panel .tag.you { background: var(--blue); color: #0c1a33; border: none; }
.panel .tag.bot { background: #6b4fd1; }
.panel .tag.turn { background: var(--gold); color: #222; border: none; animation: pulse 1.1s infinite; }
.panel .tag.dead-tag { background: #555; }
@keyframes pulse { 50% { opacity: .55; } }
.panel .p-mana { margin-left: auto; color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.hpbar { height: 14px; background: #3a1212; border-radius: 8px; margin: 8px 0 4px; overflow: hidden; position: relative; }
.hpbar .fill { height: 100%; border-radius: 8px; transition: width .35s ease; background: linear-gradient(90deg, #d64545, #e08a3c); }
.hpbar .fill.low { background: linear-gradient(90deg, #b32727, #e05252); }
.hpbar .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.buff-row { display: flex; gap: 6px; min-height: 22px; flex-wrap: wrap; margin-top: 2px; }
.buff { font-size: 12px; background: rgba(10,16,32,.65); border-radius: 8px; padding: 1px 8px; border: 1px solid var(--line); }
.panel .p-counts { position: absolute; right: 10px; bottom: 8px; color: var(--dim); font-size: 11px; }

/* 目标选择高亮 */
#table.targeting .panel.can-target { cursor: crosshair; border-color: var(--red); box-shadow: 0 0 16px rgba(224, 82, 82, .8); animation: pulse 1s infinite; }
#table.targeting .panel.can-target:hover { filter: brightness(1.3); }

/* ---------------- 底部：日志 + 手牌 ---------------- */
#bottomArea {
  display: grid;
  grid-template-columns: minmax(200px, 300px) 1fr;
  gap: 10px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  background: rgba(10, 14, 26, .85);
  min-height: 240px;
}
#logPanel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); padding-right: 12px; max-height: 118px; }
.log-title { color: var(--gold); font-size: 13px; margin-bottom: 6px; flex: 0 0 auto; }
#logList { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-height: 0; flex: 1 1 auto; }
#bottomArea { min-height: 150px; }
.log-item { color: #c7d2ec; line-height: 1.5; }
.log-item.me { color: #8fd0ff; }
#handArea { display: flex; flex-direction: column; min-width: 0; }
#handHint { height: 20px; font-size: 12.5px; color: var(--dim); margin-bottom: 4px; }
#handHint .warn { color: var(--red); }
#handRow { display: flex; gap: 8px; align-items: flex-end; overflow-x: auto; flex: 1; padding-bottom: 4px; }

/* ---------------- 手牌卡片 ---------------- */
.card {
  position: relative;
  width: 112px; height: 156px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, #2c3b63, #171f38);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  user-select: none;
  transition: transform .1s, box-shadow .1s, opacity .2s, border-color .1s;
}
.card:hover { transform: translateY(-14px); z-index: 20; }
.card.rare { border-color: var(--rare); background: linear-gradient(180deg, #46325f, #221a3a); }
.card.dim { opacity: .45; cursor: not-allowed; }
.card .cost {
  position: absolute; top: -8px; left: -8px;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7ec8ff, #2a6ccf);
  border: 2px solid #cfe6ff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
}
.card .art { font-size: 42px; text-align: center; margin-top: 14px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.card .nm { font-size: 12px; text-align: center; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .rd { font-size: 9px; text-align: center; margin-top: 2px; }
.card.rare .rd { color: var(--rare); }
.card .rd::after { content: ""; }
.card .rd.rare-tag::before { content: "★ 稀有 ★"; }
.card .rd.common-tag::before { content: "普通"; color: #9fb1dd; }
.card.rejected { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-4px);} 75% { transform: translateX(4px);} }

/* 拖拽选中的卡牌标记（会立刻出牌的类型点击即出） */
.card.instant-ready { border-color: #7dffb0; box-shadow: 0 0 10px rgba(125,255,176,.6); }

/* ---------------- 出牌拖拽 ---------------- */
.card { cursor: grab; }
.card.grabbing { cursor: grabbing; }
.card.dragging { opacity: .3; pointer-events: none; }
.drag-ghost {
  position: fixed; z-index: 3000;
  pointer-events: none;
  transform: rotate(4deg) scale(1.08);
  box-shadow: 0 18px 46px rgba(0,0,0,.65);
  opacity: .94;
  margin: 0;
}
#table.drop-zone { outline: 2px dashed var(--red); outline-offset: 8px; box-shadow: inset 0 0 40px rgba(224,82,82,.12); }
#table.drop-zone .panel.can-target {
  cursor: crosshair;
  border-color: var(--red);
  box-shadow: 0 0 18px rgba(224, 82, 82, .85);
  animation: pulse 1s infinite;
}
#table.drop-zone .panel.can-target:hover { filter: brightness(1.35); }

/* ---------------- 悬浮技能说明 ---------------- */
.tooltip {
  position: fixed; z-index: 999;
  width: 250px;
  background: rgba(16, 22, 40, .97);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  transform: translate(16px, -12px);
}
.tooltip .tip-name { font-weight: 800; font-size: 16px; }
.tooltip.rare-tip .tip-name { color: var(--rare); }
.tooltip .tip-cost { color: var(--blue); font-size: 13px; margin: 3px 0 6px; }
.tooltip .tip-desc { font-size: 13px; color: #d6def2; line-height: 1.65; }
.tooltip .tip-rare { margin-top: 8px; font-size: 11px; color: var(--rare); }

/* ---------------- Toast / 遮罩 ---------------- */
#toastBox { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: rgba(20, 28, 52, .95); border: 1px solid var(--gold);
  color: var(--text); border-radius: 20px; padding: 8px 20px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
  animation: fadein .25s;
}
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }
.overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 18, .85);
  display: grid; place-items: center; z-index: 800; backdrop-filter: blur(3px);
}
.overlay-box { text-align: center; background: var(--panel); border: 1px solid var(--gold); padding: 40px 60px; border-radius: 18px; }
.overlay-box h1 { color: var(--gold); font-size: 32px; margin-bottom: 10px; }
.overlay-box p { color: var(--dim); margin-bottom: 24px; }

/* 窄屏适配 */
@media (max-width: 900px) {
  #table[data-n="5"], #table[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
  #bottomArea { grid-template-columns: 1fr; }
  .card { width: 92px; height: 132px; }
}

/* ---------------- v2 组队 / 稀有度 / 封印 补充 ---------------- */
.panel.foe { border-color: #8a3a4a; background: linear-gradient(180deg, #3a2138, #241a30); }
.tag.team-0 { background: #c0392b; color: #fff; border: none; }
.tag.team-1 { background: #2471a3; color: #fff; border: none; }
.card.epic { border-color: #b07cff; }
.card.legendary { border-color: #ff9f43; }
.card.divine { border-color: #ffd700; box-shadow: 0 0 14px rgba(255, 215, 0, .55); }
.seal-mark {
  position: absolute; inset: 6px; display: grid; place-items: center;
  color: #ff6b6b; font-weight: 800; font-size: 15px;
  background: rgba(40, 12, 16, .55); border: 1px dashed #ff6b6b; border-radius: 8px;
}

/* ---- 开局配置面板（房主） ---- */
.cfg-box { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.cfg-box h3 { font-size: 14px; color: var(--gold); margin-bottom: 6px; }
.cfg-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.cfg-row label { width: 88px; font-size: 13px; }
.cfg-row input[type="number"] { width: 64px; padding: 4px 8px; }
.cfg-note { color: var(--dim); font-size: 11.5px; }
.cfg-total { color: var(--dim); font-size: 12.5px; }
/* ---- 卡面：元素类型角标（无需悬浮即可见） ---- */
.card .elm { position: absolute; top: 2px; right: 2px; font-size: 9px; line-height: 1.3;
  background: rgba(0,0,0,.42); border-radius: 6px; padding: 0 4px; pointer-events: none; }
.card.magic .elm { color: #8fd0ff; }
.card.shadow .elm { color: #c39bff; }
.card.nature .elm { color: #7fe3a0; }
.card.tech .elm { color: #ffd479; }
.card.time .elm { color: #9be7ff; }
.card .seal-mark { inset: 20px 6px 6px; }
/* 换牌按钮悬浮在手牌上方 */
#btnMulligan { position: relative; z-index: 5; align-self: flex-start; margin: 2px 0 6px; }
#handHint { margin-bottom: 2px; }
/* 卡面信息栏：类型 + 归属派系（无需点击） */
.card .meta { font-size: 8.5px; line-height: 1.2; text-align: center; margin-top: 2px;
  color: #b8c4e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .art { margin-top: 12px; }
/* ================= 卡牌图鉴 ================= */
#carddex { width: min(880px, 100%); }
#carddex h2 { margin-bottom: 10px; }
#dexCount { color: var(--dim); font-size: 12.5px; }
.dex-controls select { width: auto; }
.dex-body { display: grid; grid-template-columns: 1fr 300px; gap: 12px; margin-top: 10px; align-items: start; }
@media (max-width: 900px) { .dex-body { grid-template-columns: 1fr; } }
.dex-list { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; max-height: 460px; overflow-y: auto; }
.dex-card {
  width: 96px; height: 128px; cursor: pointer;
  background: linear-gradient(180deg, #2c3b63, #171f38);
  border: 2px solid var(--line); border-radius: 10px;
  padding: 4px; position: relative; text-align: center; transition: transform .1s, border-color .1s;
}
.dex-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.dex-card.rare { border-color: #b07cff; } .dex-card.legendary { border-color: #ff9f43; }
.dex-card.divine { border-color: #ffd700; }
.dex-card .cost { position:absolute; top:-7px; left:-7px; width:22px; height:22px; border-radius:50%;
  background: radial-gradient(circle at 35% 30%, #7ec8ff, #2a6ccf); border:2px solid #cfe6ff;
  display:grid; place-items:center; font-weight:800; font-size:12px; color:#fff; }
.dex-card .art { font-size: 30px; margin-top: 12px; }
.dex-card .nm { font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dex-card .meta2 { font-size: 8px; color: #b8c4e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.dex-card .rd2 { font-size: 8.5px; color: #9fb1dd; }
.dex-empty { color: var(--dim); font-size: 13px; padding: 18px 4px; }
.dex-detail { position: sticky; top: 8px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.7; }
.dex-detail .dt-name { font-size: 19px; font-weight: 800; }
.dex-detail .dt-line { color: var(--dim); font-size: 12px; margin: 2px 0; }
.dex-detail .dt-eff { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.dex-detail .dt-eff .eff { font-size: 12.5px; margin: 2px 0; }
.dex-detail .dt-eff .kind { display:inline-block; margin: 2px 6px 0 0; }
.dex-detail .tag { font-size: 11px; padding: 1px 8px; border-radius: 8px; display: inline-block; margin-right: 6px; }

/* 大厅 Hub */
.acct-bar { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 10px 0 2px; flex-wrap: wrap; }
#acctForm { width: min(440px,100%); margin: 8px auto; text-align:center; }
#acctForm .row { justify-content: center; }
#acctForm input { margin: 6px; width: 220px; }
#hubTabs { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
#hubTabs .tab { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 20px;
  padding: 7px 16px; cursor: pointer; font-size: 14px; }
#hubTabs .tab.active { background: linear-gradient(135deg,#f0a13c,#d1495b); border-color:#ffd9a0; font-weight:700; color:#fff; }
#view-lobby > section:not(.hero) { margin-top: 6px; }

/* 主线冒险 */
.camp-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.camp-row { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.camp-row .row { gap: 6px; }
/* 商店 */
.shop-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shop-row { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.shop-row b { width: 150px; }
.shop-row span { flex: 1; color: var(--dim); font-size: 12.5px; }
/* 对局内功能卡按钮 */
#specialBar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 2px 0 6px; }
.special-btn { background: var(--panel2); border: 1px solid var(--rare); color: var(--rare);
  border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.special-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 商店 */
.shop-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shop-row { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.shop-row b { width: 150px; }
.shop-row span { flex: 1; color: var(--dim); font-size: 12.5px; }
#specialBar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 2px 0 6px; }
.special-btn { background: var(--panel2); border: 1px solid var(--rare); color: var(--rare);
  border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.special-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 音频控制 */
#audioBar { position: fixed; right: 12px; bottom: 12px; z-index: 990; display: flex; gap: 8px; }
.audio-toggle { background: rgba(20,28,52,.9); border: 1px solid var(--line); color: var(--text);
  border-radius: 18px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.audio-toggle:hover { filter: brightness(1.2); }

/* 战斗播报条 */
#castBanner { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 700;
  max-width: min(92vw, 760px); text-align: center; pointer-events: none;
  background: rgba(12,16,30,.88); border: 1px solid var(--line); color: var(--text);
  border-radius: 20px; padding: 7px 18px; font-size: 14px; line-height: 1.6;
  box-shadow: 0 8px 26px rgba(0,0,0,.55); animation: castIn .18s ease-out; }
#castBanner.enemy { border-color: #e05252; color: #ffd7d7; }
#castBanner.me { border-color: #5aa7ff; color: #d5ecff; }
@keyframes castIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ============ 视觉优化（美学统一） ============ */
body { background: radial-gradient(1200px 700px at 50% -10%, #23315a 0%, #10152a 60%, #0b0f1f 100%); }
#view-lobby, #view-battle { background: transparent; }
.hero h1, #castBanner .hot, .site-hero h1 {
  background: linear-gradient(135deg, #ffd479, #ff9f43 45%, #ff5e7e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 26px rgba(255,159,67,.18); }
.card-box { box-shadow: 0 14px 40px rgba(0,0,0,.28); backdrop-filter: blur(2px); }
.panel, .card-box, .card, .dex-card { border-radius: 14px; }
.card:hover, .dex-card:hover { box-shadow: 0 6px 18px rgba(90,167,255,.35); }
.btn.primary { box-shadow: 0 6px 18px rgba(209,73,91,.35); }
.btn.primary:hover { box-shadow: 0 8px 24px rgba(240,161,60,.45); }
#topBar { background: rgba(10,14,26,.55); backdrop-filter: blur(6px); }
#bottomArea { background: rgba(10,14,26,.6); backdrop-filter: blur(6px); }
.card .art { filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); transition: transform .15s; }
.card:hover .art { transform: scale(1.06); }
.hpbar { box-shadow: inset 0 1px 4px rgba(0,0,0,.6); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #3a4a78; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #52649a; }
#hubTabs .tab { transition: all .15s; }
#hubTabs .tab.active { box-shadow: 0 4px 14px rgba(240,161,60,.4); }
.foot a { transition: color .2s; }
.toast { backdrop-filter: blur(4px); }
.lobby-row:hover { filter: brightness(1.1); }
.camp-row, .shop-row { transition: transform .1s, box-shadow .15s; }
.camp-row:hover, .shop-row:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.3); }

/* ====== 战斗反馈与流畅度 ====== */
.hpbar.lowbar .fill { background: linear-gradient(90deg,#8f1212,#ff2d2d); animation: lowblink 1s steps(2) infinite; }
@keyframes lowblink { 50% { filter: brightness(1.6); } }
.float-dmg { position: absolute; right: 10px; top: 34px; font-weight: 800; font-size: 16px;
  pointer-events: none; animation: floatUp .95s ease-out forwards; z-index: 6;
  text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.float-dmg.hurt { color: #ff6b6b; }
.float-dmg.heal { color: #6bff9b; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(4px); } 18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px); } }
#table.turn-pulse { animation: turnPulse .6s ease; }
@keyframes turnPulse { 30% { box-shadow: inset 0 0 0 2px rgba(245,197,66,.65); } }
#handRow .card { will-change: transform; }
.panel { transition: filter .2s, box-shadow .2s; }
.btn, .tab, .special-btn, .audio-toggle { transition: transform .08s ease, filter .15s, box-shadow .2s; }
.btn:active:not(:disabled), .tab:active { transform: scale(.97); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tooltip { transition: opacity .12s; }
/* 尊重“减少动态效果”系统偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

.foot .ver { color: var(--gold); }

/* ===== 回合倒计时条 ===== */
#turnTimer { position: relative; display: inline-flex; align-items: center; gap: 6px;
  background: #10162a; border: 1px solid var(--line); border-radius: 16px; padding: 3px 8px 3px 3px;
  width: 150px; overflow: hidden; vertical-align: middle; margin-left: 10px; }
#turnTimer i { position: relative; display: block; height: 18px; border-radius: 12px;
  background: linear-gradient(90deg, #3fae5a, #e0b23c); transition: width .25s linear; min-width: 4px; }
#turnTimer b { position: absolute; right: 8px; top: 3px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
#turnTimer.warn i { background: linear-gradient(90deg, #ff8f3c, #e04040); }
#turnTimer.warn { animation: lowblink .8s steps(2) infinite; }
/* 主题选择 */
.theme-pick { margin: 8px auto 0; display: flex; gap: 6px; align-items: center; justify-content: center; }
.theme-pick label { color: var(--dim); font-size: 13px; }
.theme-pick select { padding: 4px 8px; }
/* 击杀特写 */
#koFlash { position: fixed; left: 50%; top: 38%; transform: translate(-50%,-50%) scale(.8);
  font-size: 34px; font-weight: 900; color: #ff5e6e; letter-spacing: 2px; z-index: 950;
  opacity: 0; pointer-events: none; text-shadow: 0 4px 18px rgba(255,60,90,.6); }
#koFlash.show { animation: koPop 1.5s ease forwards; }
@keyframes koPop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); }
  16% { opacity: 1; transform: translate(-50%,-50%) scale(1.12); }
  30% { transform: translate(-50%,-50%) scale(1); }
  75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-60%) scale(1.05); } }
/* 终局统计 */
.over-stats { margin: 6px 0 16px; }
.stat-row { color: var(--text); font-size: 13px; line-height: 1.9; }
/* 主题皮肤 */
html[data-theme="crimson"] { --bg: #1a0c10; --bg2: #2a1016; --panel: #3a1620; --panel2: #4d1f2a;
  --line: #7a2a3a; --gold: #ffb347; --red: #ff5566; --text: #ffe9e6; }
html[data-theme="crimson"] body { background: radial-gradient(1200px 700px at 50% -10%, #5c1220 0%, #1a0c10 70%); }
html[data-theme="emerald"] { --bg: #0a1712; --bg2: #0f2419; --panel: #123126; --panel2: #1a4534;
  --line: #2e6a4f; --gold: #9be86b; --text: #e9ffe9; }
html[data-theme="emerald"] body { background: radial-gradient(1200px 700px at 50% -10%, #12472e 0%, #0a1712 70%); }

.recent { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:8px; }
.recent .btn { padding: 2px 10px; font-size:12px; }
.recent-item { display:inline-flex; gap:4px; align-items:center; background:var(--panel2); border:1px solid var(--line); border-radius:8px; padding:2px 4px; }
.recent-chip { font-size:11px; cursor:help; }
.btn.mini.ghost { background:transparent; color:var(--text); opacity:.8; padding:2px 6px; }
.btn.mini.ghost:hover { opacity:1; background:var(--panel2); }
.tag.warn-tag { background:#b7791f; color:#fff; border:none; }
.offline-tag { font-variant-numeric: tabular-nums; }
