/* ============================================================
   卡牌 v4（纸面桌游卡：真实卡面 + 图片失败 CSS 回退）
   尺寸由 --cw 控制；身份牌 244:382，装备牌 1053:680
   ============================================================ */

.card {
  position: relative;
  flex: none;
  border-radius: 7px;
  overflow: hidden;
  background: #101318;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.32);
  transition: transform 0.16s var(--ease-out, ease), box-shadow 0.16s var(--ease-out, ease);
}
.card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 3;
}
.card-art.art-missing { display: none; }
.card-art-back { z-index: 3; }

.size-xs { --cw: 34px; width: var(--cw); }
.size-sm { --cw: 58px; width: var(--cw); }
.size-md { --cw: 74px; width: var(--cw); }
.size-lg { --cw: 88px; width: var(--cw); }
.size-xl { --cw: 104px; width: var(--cw); }
.size-seat { --cw: 28px; width: var(--cw); }
.size-own { --cw: 104px; width: var(--cw); }

.id-card,
.card.is-landscape { aspect-ratio: 244 / 382; }
.equip-card,
.card.is-landscape { aspect-ratio: 1053 / 680; }
.id-card { width: var(--cw, 58px); }
.equip-card { width: var(--cw, 88px); }

/* 牌角槽位字母 */
.card-slot {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 5;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(16, 19, 24, 0.72);
  color: rgba(234, 223, 201, 0.92);
  font: 800 9px/14px var(--mono);
  text-align: center;
  pointer-events: none;
}
.size-lg .card-slot,
.size-xl .card-slot,
.size-sm .card-slot,
.size-md .card-slot { min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; }
.size-seat .card-slot,
.size-xs .card-slot { display: none; }

/* 角标：仅你可见 / 公开 / 淘汰 */
.card-tag {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 15px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(16, 19, 24, 0.78);
  color: rgba(234, 223, 201, 0.92);
  font: 700 8px/15px var(--font);
  letter-spacing: 0.02em;
  pointer-events: none;
}
.card-tag .icon { width: 9px; height: 9px; }
.card-tag.is-secret { color: #f0dcae; }
.card-tag.is-public { background: var(--mustard, #e3a72f); color: #1b2430; }
.card-eliminated {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-10deg);
  z-index: 6;
  padding: 1px 5px;
  border: 2px solid rgba(169, 58, 38, 0.7);
  border-radius: 3px;
  color: rgba(169, 58, 38, 0.95);
  background: rgba(234, 223, 201, 0.7);
  font: 800 10px/1.2 var(--font);
  letter-spacing: 0.1em;
  white-space: nowrap;
  pointer-events: none;
}
.id-card.eliminated { filter: grayscale(0.85) brightness(0.8); }
.id-card.dim, .equip-card.dim { opacity: 0.45; }
.id-card.is-empty-slot { background: transparent; border: 2px dashed rgba(58, 74, 90, 0.35); box-shadow: none; }
.id-card.face-up { box-shadow: 0 0 0 2px var(--mustard, #e3a72f), 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.32); }
.id-card.face-down-known { box-shadow: 0 0 0 2px rgba(227, 167, 47, 0.55), 0 2px 0 rgba(0, 0, 0, 0.35); }
.id-card.mine { box-shadow: 0 0 0 2px rgba(227, 167, 47, 0.45), 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 20px rgba(0, 0, 0, 0.36); }
.id-card.flippable { cursor: pointer; }
.id-card.flippable:hover { transform: translateY(-3px); }
.id-card.selectable, .equip-card.selectable { cursor: pointer; }
.id-card.selectable:hover, .equip-card.selectable:hover { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--mustard, #e3a72f), 0 8px 18px rgba(0, 0, 0, 0.4); }
.id-card.selected, .equip-card.selected { box-shadow: 0 0 0 3px var(--mustard, #e3a72f), 0 8px 18px rgba(0, 0, 0, 0.4); }
.id-card.ghost { opacity: 0.35; }

/* 3D 翻转（自己的身份牌） */
.id-card.flippable { perspective: 900px; }
.id-card .card-3d {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.42s var(--ease-out, ease);
}
.id-card.is-flipped .card-3d { transform: rotateY(180deg); }
.card-side { position: absolute; inset: 0; backface-visibility: hidden; border-radius: inherit; overflow: hidden; }
.card-front { background: #101318; }
.card-note {
  transform: rotateY(180deg);
  background: var(--paper, #eadfc9);
  color: var(--ink, #1b2430);
  padding: 8%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2%;
}
.card-note .fb-frame {
  position: absolute;
  inset: 5%;
  border: 2px solid rgba(58, 74, 90, 0.28);
  border-radius: 4px;
  pointer-events: none;
}
.note-kicker { font: 700 calc(var(--cw, 88px) * 0.052)/1 var(--mono); letter-spacing: 0.22em; color: rgba(58, 74, 90, 0.66); }
.note-name { font: 800 calc(var(--cw, 88px) * 0.13)/1.2 var(--font-serif); letter-spacing: 0.06em; color: var(--ink, #1b2430); }
.note-en { font: 700 calc(var(--cw, 88px) * 0.045)/1 var(--mono); letter-spacing: 0.14em; color: rgba(58, 74, 90, 0.6); margin-bottom: 4%; }
.note-line { display: flex; align-items: baseline; gap: 5px; font: 600 calc(var(--cw, 88px) * 0.055)/1.3 var(--font); color: rgba(27, 36, 48, 0.8); }
.note-line b { font-weight: 800; }
.note-line b.is-crooked { color: var(--brick, #a93a26); }
.note-line b.is-honest { color: var(--navy, #24568c); }
.note-hint { margin-top: 4%; font: 600 calc(var(--cw, 88px) * 0.048)/1.3 var(--font); color: rgba(58, 74, 90, 0.6); }

/* 小阵营角标 */
.card-mini-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 5;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(16, 19, 24, 0.75);
  color: var(--paper, #eadfc9);
  pointer-events: none;
}
.card-mini-badge .icon { width: 9px; height: 9px; }
.card-mini-badge.is-honest { background: rgba(36, 86, 140, 0.92); }
.card-mini-badge.is-crooked { background: rgba(169, 58, 38, 0.92); }
.size-seat .card-mini-badge, .size-xs .card-mini-badge, .size-sm .card-mini-badge { display: none; }

/* 图片失败时的纸面回退 */
.card-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  border-radius: inherit;
  overflow: hidden;
}
.card.art-missing .card-fallback { z-index: 4; }
.id-fallback {
  background: linear-gradient(160deg, #f1e8d4 0%, #e2d5ba 100%);
  color: var(--ink, #1b2430);
  padding: 8%;
  justify-content: flex-end;
  gap: 2%;
}
.card-fallback .fb-frame {
  position: absolute;
  inset: 5%;
  border: 2px solid rgba(58, 74, 90, 0.28);
  border-radius: 4px;
  pointer-events: none;
}
.card-fallback .fb-emblem {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  color: rgba(58, 74, 90, 0.5);
  display: flex;
}
.fb-emblem .icon { width: calc(var(--cw, 88px) * 0.34); height: calc(var(--cw, 88px) * 0.34); }
.fb-name { font: 800 calc(var(--cw, 88px) * 0.12)/1.2 var(--font-serif); letter-spacing: 0.06em; }
.fb-en { font: 700 calc(var(--cw, 88px) * 0.045)/1 var(--mono); letter-spacing: 0.14em; color: rgba(58, 74, 90, 0.6); }
.size-seat .fb-en, .size-xs .fb-en { display: none; }
.id-fallback.is-back { justify-content: center; align-items: center; background: linear-gradient(160deg, #e7dcc4 0%, #d6c8ab 100%); }
.fb-back-mark { font: 800 calc(var(--cw, 88px) * 0.18)/1 var(--font-serif); letter-spacing: 0.3em; color: rgba(58, 74, 90, 0.5); }
.fb-back-sub { font: 700 calc(var(--cw, 88px) * 0.05)/1 var(--mono); letter-spacing: 0.28em; color: rgba(58, 74, 90, 0.4); margin-top: 6%; }
.id-fallback.is-empty { justify-content: center; align-items: center; background: transparent; border: none; }
.id-fallback.is-empty .fb-frame { border-style: dashed; border-color: rgba(58, 74, 90, 0.32); }
.fb-empty { font: 700 calc(var(--cw, 88px) * 0.1)/1 var(--font); letter-spacing: 0.12em; color: rgba(58, 74, 90, 0.55); }

/* 装备牌 */
.equip-card { background: #101318; }
.equip-fallback {
  background: linear-gradient(150deg, #f1e8d4 0%, #e0d2b6 100%);
  color: var(--ink, #1b2430);
  padding: 6% 7%;
  justify-content: space-between;
}
.fb-equip-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; z-index: 2; }
.fb-equip-num { font: 800 calc(var(--cw, 88px) * 0.048)/1 var(--mono); color: rgba(58, 74, 90, 0.7); }
.fb-equip-timing { font: 700 calc(var(--cw, 88px) * 0.042)/1 var(--font); color: rgba(58, 74, 90, 0.66); letter-spacing: 0.06em; }
.fb-equip-mark {
  position: absolute;
  right: 7%;
  top: 22%;
  width: calc(var(--cw, 88px) * 0.34);
  height: calc(var(--cw, 88px) * 0.34);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(58, 74, 90, 0.12);
  color: rgba(27, 36, 48, 0.75);
  font: 800 calc(var(--cw, 88px) * 0.16)/1 var(--font-serif);
}
.fb-equip-name { font: 800 calc(var(--cw, 88px) * 0.075)/1.15 var(--font-serif); letter-spacing: 0.04em; z-index: 2; }
.fb-equip-text { font: 500 calc(var(--cw, 88px) * 0.042)/1.35 var(--font); color: rgba(27, 36, 48, 0.72); z-index: 2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.equip-card.is-empty { background: transparent; border: 2px dashed rgba(58, 74, 90, 0.35); box-shadow: none; }
.equip-empty-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--slate, #3a4a5a); }
.equip-empty-inner .icon { width: 20px; height: 20px; opacity: 0.6; }
.equip-empty-inner span { font: 600 10px/1.2 var(--font); }
.card-back-only .card-art { z-index: 3; }
.card.is-back.is-landscape { border-color: transparent; }

/* 受伤牌 */
.wound-card {
  display: inline-block;
  width: 22px;
  aspect-ratio: 244 / 382;
  border-radius: 3px;
  overflow: hidden;
  flex: none;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background: #101318;
}
.wound-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.seat__foot .wound-card { width: 16px; }

/* 小物（枪 / 伤） */
.art-token { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.art-token img { display: block; max-width: 18px; max-height: 12px; object-fit: contain; }
.art-token-wounded img { width: 12px; height: 12px; object-fit: contain; }
.art-token .art-fallback-icon { display: none; width: 12px; height: 12px; }
.art-token.art-missing .art-fallback-icon { display: inline-flex; }
.chip .art-token img { max-width: 15px; max-height: 11px; }
.chip .art-token-wounded img { width: 11px; height: 11px; }
