/* 二代：赛道图层、变数卡、棋盘标识与新事件演出（与 style.css 分开，便于合并） */

/* 顶栏赛程胶囊：二代赛道配色 */
.race-pill.twisty { --pc: #F25CA2; }
.race-pill.whirly { --pc: #0072B2; }
.race-pill.v2 .no { background: var(--pc); }

/* ---------- 赛道 SVG ---------- */
.track-thumb { display: block; width: 100%; height: auto; }
#trackSvg .twist-sign .tw-glow, .track-thumb .twist-sign .tw-glow { opacity: 0; }
#trackSvg .twist-sign { transition: opacity .4s, filter .4s; }
#trackSvg .twist-sign.used { filter: saturate(.35) brightness(.96); }
#trackSvg .twist-sign.tw-flash .tw-glow { animation: twGlow 1.1s ease-out; }
#trackSvg .twist-sign.tw-flash { animation: twShake .5s ease-in-out 2; transform-box: fill-box; }
@keyframes twGlow { 0% { opacity: 0; } 15% { opacity: 1; } 35% { opacity: .35; } 55% { opacity: 1; } 100% { opacity: 0; } }
@keyframes twShake { 25% { filter: brightness(1.25); } 50% { filter: none; } 75% { filter: brightness(1.25); } }
#trackSvg .twl-pipe .twl-shine { stroke-dashoffset: 0; }
#trackSvg .twl-pipe.flow .twl-shine { animation: pipeFlow .5s linear infinite; opacity: 1; stroke-width: 2.4; }
#trackSvg .twl-pipe.flow .twl-core { filter: brightness(1.3) drop-shadow(0 0 3px #fff); }
@keyframes pipeFlow { to { stroke-dashoffset: -18; } }

/* ---------- 棋盘上的二代状态 ---------- */
.v2-layer { position: absolute; inset: 0; pointer-events: none; }
.v2-coin {
  position: absolute; width: calc(20 * var(--u)); height: calc(20 * var(--u)); margin: calc(-10 * var(--u)) 0 0 calc(-10 * var(--u));
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF1B8, var(--gold) 60%); border: calc(2 * var(--u)) solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 900; font-size: calc(11 * var(--u)); color: var(--ink);
  box-shadow: calc(1.5 * var(--u)) calc(1.5 * var(--u)) 0 var(--ink); z-index: 1;
}
.v2-coin.pop { animation: v2Pop .45s var(--ease) both; }
.v2-coin.take { animation: v2Take .26s ease-in forwards; }
@keyframes v2Pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: none; } }
@keyframes v2Take { to { transform: translateY(-60%) scale(1.4); opacity: 0; } }
.v2-monster {
  position: absolute; width: calc(34 * var(--u)); height: calc(34 * var(--u)); margin: calc(-17 * var(--u)) 0 0 calc(-17 * var(--u));
  z-index: 10; transition: left .12s ease-out, top .12s ease-out; filter: drop-shadow(calc(1.5 * var(--u)) calc(2 * var(--u)) 0 rgba(35, 31, 51, .55));
}
.v2-monster svg { width: 100%; height: 100%; display: block; }
.v2-monster.pop { animation: v2Pop .5s var(--ease); }
.v2-monster.hop svg { animation: v2Hop .2s ease-out; }
@keyframes v2Hop { 50% { transform: translateY(-30%) scale(1.08, .94); } }
.board.tall .v2-monster { width: calc(30 * var(--u)); height: calc(30 * var(--u)); margin: calc(-15 * var(--u)) 0 0 calc(-15 * var(--u)); }

/* 变数徽标：生效中的变数卡，点一下 / 悬停看效果 */
.v2-badges { position: absolute; z-index: 12; display: flex; flex-wrap: wrap; gap: calc(5 * var(--u)); pointer-events: none; }
.v2-badges[hidden] { display: none; }
.v2-badges.tall { flex-direction: column; align-items: flex-end; }
.v2-chip {
  pointer-events: auto; display: inline-flex; align-items: center; gap: calc(3 * var(--u)); max-width: 100%;
  min-height: max(22px, calc(24 * var(--u))); padding: 0 calc(8 * var(--u)) 0 calc(3 * var(--u));
  border: calc(2 * var(--u)) solid var(--ink); border-radius: 99px; background: #FFF3B0; color: var(--ink);
  font: inherit; font-size: max(10px, calc(12 * var(--u))); font-weight: 900; line-height: 1; cursor: pointer;
  box-shadow: calc(2 * var(--u)) calc(2 * var(--u)) 0 var(--ink); transition: transform .15s var(--ease), opacity .2s;
}
.v2-chip b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-chip:hover { transform: translateY(-1px); }
.v2-chip:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.v2-ci { flex: none; width: max(16px, calc(18 * var(--u))); height: max(16px, calc(18 * var(--u))); display: block; }
.v2-ci svg { width: 100%; height: 100%; display: block; }
.v2-chip.incoming { opacity: 0; }
.v2-chip.v2-land { animation: v2Pop .5s var(--ease); }
.v2-pop {
  position: absolute; left: 0; top: calc(100% + 6px); width: max(190px, calc(230 * var(--u))); z-index: 30; pointer-events: auto;
  padding: 8px 11px 9px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-sm);
  text-align: left; animation: comIn .25s var(--ease);
}
.v2-badges.tall .v2-pop { left: auto; right: 0; }
.v2-pop b { display: block; font-size: 14px; font-weight: 900; }
.v2-pop p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.45; font-weight: 700; color: var(--ink2); }

/* 运动员小标签：狼人、野猪、灵魂伴侣 */
.token .v2-tags { position: absolute; left: -14%; top: -12%; display: flex; gap: calc(2 * var(--u)); pointer-events: none; z-index: 3; }
.token .v2-tags i { font-style: normal; }
.token .v2-hog { display: inline-flex; align-items: center; height: calc(16 * var(--u)); padding: 0 calc(4 * var(--u)); border-radius: 99px; background: #8A5A35; color: #fff; border: calc(1.5 * var(--u)) solid var(--ink); font-size: calc(10 * var(--u)); font-weight: 900; }
.token .v2-mate { display: block; width: calc(17 * var(--u)); height: calc(17 * var(--u)); }
.token .v2-mate svg { width: 100%; height: 100%; display: block; }
.token.v2-wolf .body { box-shadow: 0 0 0 calc(2 * var(--u)) var(--ink), 0 0 0 calc(6 * var(--u)) rgba(107, 79, 168, .8), calc(2 * var(--u)) calc(3 * var(--u)) 0 calc(5 * var(--u)) var(--ink); }
.token.v2-howl .hop { animation: v2Howl .9s var(--ease); }
@keyframes v2Howl { 20% { transform: scale(1.25) rotate(-8deg); } 45% { transform: scale(1.2) rotate(8deg); } 70% { transform: scale(1.1); } }
.token.v2-popin .hop { animation: v2Pop .45s var(--ease); }

/* ---------- 变数卡浮现 ---------- */
.twist-card { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; pointer-events: none; perspective: 900px; }
.tw-face {
  width: min(300px, 82vw); max-height: 86vh; overflow: hidden; box-sizing: border-box; text-align: center;
  padding: 12px 18px 14px; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  background: repeating-linear-gradient(-40deg, #FFF7D6 0 14px, #FFEFB0 14px 28px); color: var(--ink);
  backface-visibility: hidden; transform-style: preserve-3d;
}
.tw-art svg { display: block; width: 120px; height: 52px; margin: 0 auto 2px; }
.tw-kicker { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.tw-name { display: block; margin-top: 6px; font-size: 28px; font-weight: 900; line-height: 1.1; color: #F25CA2; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 2px 2px 0 var(--ink); }
.tw-en { display: block; margin-top: 3px; font-size: 12px; font-weight: 800; color: var(--ink2); letter-spacing: .04em; }
.tw-text { margin: 8px 0 0; font-size: 15px; font-weight: 800; line-height: 1.5; }
.tw-who { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 99px; background: #fff; border: 2px solid var(--ink); font-size: 12px; font-weight: 900; }
@media (max-height: 460px) {
  .tw-face { padding: 8px 14px 10px; }
  .tw-art svg { height: 34px; }
  .tw-name { font-size: 22px; margin-top: 4px; }
  .tw-text { font-size: 13.5px; margin-top: 5px; }
  .tw-who { margin-top: 5px; }
}

/* ---------- 骰子区：多骰、暗箱、作废 ---------- */
.v2-rolls { display: grid; grid-template-columns: repeat(3, auto); gap: calc(8 * var(--u)); }
.v2-rolls .die { width: calc(44 * var(--u)) !important; height: calc(44 * var(--u)) !important; animation-delay: calc(var(--k) * 40ms); }
.v2-rolls .die.dup { filter: drop-shadow(0 0 calc(5 * var(--u)) var(--yellow)); }
.v2-rolls .die:not(.dup) { opacity: .55; }
.v2-cheat { display: flex; align-items: center; gap: calc(10 * var(--u)); font-weight: 900; }
.v2-cheat > div { display: flex; flex-direction: column; align-items: center; gap: calc(2 * var(--u)); padding: calc(6 * var(--u)) calc(12 * var(--u)); background: var(--paper); border: calc(2.5 * var(--u)) solid var(--ink); border-radius: calc(12 * var(--u)); box-shadow: var(--shadow-sm); }
.v2-cheat span { font-size: calc(12 * var(--u)); color: var(--ink2); }
.v2-cheat b { font-size: calc(30 * var(--u)); line-height: 1; }
.v2-cheat i { font-style: normal; font-size: calc(30 * var(--u)); }
.v2-cheat.hit i { color: var(--red); }
.v2-cheat.miss i { color: var(--green); }
.v2-void { position: relative; }
.v2-void > i { position: absolute; left: -8%; right: -8%; top: 46%; height: calc(7 * var(--u)); background: var(--red); border: calc(1.5 * var(--u)) solid var(--ink); border-radius: 99px; transform: rotate(-35deg); }
.v2-mdie svg rect:first-child { fill: #E9DDFB; }
.v2-curse svg rect:first-child { fill: #E3D7FF; }

/* 跳蚤市场浮层 */
.v2-swapmeet .ov-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  #trackSvg .twl-pipe.flow .twl-shine, .v2-coin.pop, .v2-monster.pop, .token.v2-howl .hop, .token.v2-popin .hop, .v2-chip.v2-land { animation: none; }
}

/* 手机蛇形赛道的漩涡管道：平时隐身，传送时才亮起 */
.twl-pipe.twl-ghost { opacity: 0; transition: opacity .2s; }
.twl-pipe.twl-ghost.flow { opacity: 1; }
