/* ==================================================================
   羽林对决 · Badminton Arena
   视觉：深夜球场 + 荧光绿极光；场地为真实羽毛球场地（长边水平）
   ================================================================== */

:root {
  --bg: #060a12;
  --panel: rgba(17, 26, 43, 0.72);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --txt: #e8eef7;
  --txt-dim: #8d9bb3;
  --txt-faint: #5f6d84;

  --lime: #c9f24a;
  --green: #52e08a;
  --cyan: #45d6d6;
  --orange: #ffa14a;
  --red: #ff6b6b;
  --violet: #9b8cff;

  --court-a: #0d4632;
  --court-b: #07281d;
  --court-line: rgba(255, 255, 255, 0.5);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 90vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 42% at 22% 16%, rgba(82, 224, 138, 0.20), transparent 62%),
    radial-gradient(40% 38% at 78% 10%, rgba(69, 214, 214, 0.16), transparent 60%),
    radial-gradient(36% 34% at 52% 42%, rgba(201, 242, 74, 0.10), transparent 64%);
  filter: blur(28px);
  animation: floaty 16s ease-in-out infinite alternate;
}

@keyframes floaty {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(0, 3%, 0) scale(1.06); }
}

/* ------------------------------ 顶部 ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 11px clamp(14px, 3vw, 34px);
  background: rgba(6, 10, 18, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }

.brand-mark { font-size: 24px; filter: drop-shadow(0 0 10px rgba(201, 242, 74, 0.5)); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: 0.08em; }
.brand-text em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--txt-faint);
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab {
  padding: 6px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--txt-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.tab:hover { color: var(--txt); }

.tab.is-active {
  background: linear-gradient(135deg, var(--lime), var(--green));
  color: #06170e;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(82, 224, 138, 0.28);
}

/* 比分条 */
.scorebar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 13px;
}

.score-side { display: flex; align-items: center; gap: 6px; color: var(--txt-dim); }
.score-side b { font-family: var(--mono); font-size: 20px; color: var(--txt); line-height: 1; }
.score-sep { color: var(--txt-faint); }

.score-target {
  font-size: 10.5px;
  color: var(--txt-faint);
  padding-left: 9px;
  margin-left: 3px;
  border-left: 1px solid var(--line);
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-p { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-a { background: var(--red); box-shadow: 0 0 8px var(--red); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.diff-blurb {
  order: 4;
  width: 100%;
  margin: 0;
  font-size: 11.5px;
  color: var(--txt-faint);
  letter-spacing: 0.02em;
}

.diff-switch {
  display: flex;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.diff-switch button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--txt-dim);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.2s;
}

.diff-switch button.is-active {
  background: rgba(155, 140, 255, 0.18);
  color: var(--violet);
  font-weight: 700;
}

/* ------------------------------ 通用 ------------------------------ */
.stage {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 34px) 40px;
}

.view { display: none; animation: fade 0.35s ease; }
.view.is-active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--txt);
  padding: 9px 16px;
  font-size: 14px;
  transition: 0.18s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn:disabled { opacity: 0.36; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--lime), var(--green));
  color: #06170e;
  border: 0;
  font-weight: 700;
  padding: 11px 26px;
  font-size: 15px;
}

.btn-ghost { font-size: 13px; padding: 7px 14px; }

.hint { color: var(--txt-faint); font-size: 12px; }

/* ------------------------------ 布局 ------------------------------ */
.match-grid {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 252px;
  gap: 16px;
  align-items: start;
}

/* ------------------------------ 选手面板 ------------------------------ */
.fighter { padding: 15px; }

.fighter-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }

.avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
}

.avatar-p {
  background: linear-gradient(135deg, rgba(201, 242, 74, 0.9), rgba(82, 224, 138, 0.9));
  color: #06170e;
  box-shadow: 0 0 22px rgba(82, 224, 138, 0.34);
}

.avatar-a {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(255, 161, 74, 0.9));
  color: #24100a;
  box-shadow: 0 0 22px rgba(255, 107, 107, 0.3);
}

.fighter-id { flex: 1; min-width: 0; }
.fighter-id h3 { margin: 0; font-size: 15.5px; }
.fighter-id p {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--txt-faint);
}

.score {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 0 22px rgba(201, 242, 74, 0.45);
}

#aiPanel .score { color: var(--red); text-shadow: 0 0 22px rgba(255, 107, 107, 0.4); }

.stamina { margin-bottom: 13px; }

.stamina-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--txt-dim);
  margin-bottom: 6px;
}

.stamina-top b { font-family: var(--mono); color: var(--txt); }

.track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--lime));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.track .fill-ai { background: linear-gradient(90deg, var(--red), var(--orange)); }

.stats { list-style: none; margin: 0 0 13px; padding: 0; border-top: 1px solid var(--line); }

.stats li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--txt-dim);
}

.stats li b { font-family: var(--mono); color: var(--txt); font-size: 13.5px; }

.last-card label { display: block; font-size: 11px; color: var(--txt-dim); margin-bottom: 6px; }

.card-slot {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  font-size: 12.5px;
  color: var(--txt-faint);
  text-align: center;
  padding: 4px 8px;
  line-height: 1.3;
}

.card-slot.is-a { border-style: solid; border-color: rgba(255, 107, 107, 0.5); color: var(--red); background: rgba(255, 107, 107, 0.08); }
.card-slot.is-d { border-style: solid; border-color: rgba(69, 214, 214, 0.5); color: var(--cyan); background: rgba(69, 214, 214, 0.08); }

/* ================================================================
   球场 —— 真实羽毛球场地，长边水平，13.40m × 5.18m
   ================================================================ */
.court-wrap { display: grid; gap: 11px; align-content: start; }

.court-head { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--txt-dim);
  white-space: nowrap;
}

.pill-dim { color: var(--txt-faint); }

.pill-accent {
  color: var(--lime);
  border-color: rgba(201, 242, 74, 0.34);
  background: rgba(201, 242, 74, 0.1);
}

.pill-warn { color: var(--orange); border-color: rgba(255, 161, 74, 0.36); background: rgba(255, 161, 74, 0.1); }

.court {
  position: relative;
  aspect-ratio: 13.4 / 6.1;
  border: 2px solid var(--court-line);
  border-radius: 6px;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, 0.02) 22px 23px),
    linear-gradient(180deg, var(--court-a), var(--court-b));
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5), 0 20px 46px rgba(0, 0, 0, 0.45);
}

/* 八区网格 */
.zone-grid { position: absolute; inset: 0; z-index: 2; }

.z {
  position: absolute;
  width: 12.5%;
  height: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: start center;
  padding-top: 5px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  transition: background 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.z.is-self { background: rgba(255, 255, 255, 0.018); }
.z.is-foe { background: rgba(255, 255, 255, 0.004); }

.z.is-target {
  border-color: rgba(201, 242, 74, 0.85);
  background: rgba(201, 242, 74, 0.12);
  color: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(201, 242, 74, 0.4);
}

.z.is-pickable { cursor: crosshair; }
.z.is-pickable:hover { background: rgba(201, 242, 74, 0.16); border-color: rgba(201, 242, 74, 0.6); }
.z.is-serve-only { cursor: not-allowed; opacity: 0.4; }
.z.is-chosen {
  border-style: solid;
  border-color: var(--lime);
  background: rgba(201, 242, 74, 0.2);
  box-shadow: inset 0 0 0 1px var(--lime), 0 0 18px rgba(201, 242, 74, 0.28);
  color: #fff;
}

.z.is-occupied { background: rgba(255, 255, 255, 0.06); }

/* 场地线 —— 按真实羽毛球双打场地 13.40m × 6.10m 定位（长边水平）
   前发球线距网 1.98m，双打后发线距端线 0.76m，
   单打边线比双打边线内缩 0.46m（每侧） */
.lines { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ln { position: absolute; background: rgba(255, 255, 255, 0.42); }

/* 中线：分左右半区 */
.ln-mid { left: 0; right: 0; top: 50%; height: 1.5px; opacity: 0.85; }

/* 单打边线（内侧两条） */
.ln-single-t { left: 0; right: 0; top: 7.54%; height: 1.5px; }
.ln-single-b { left: 0; right: 0; top: 92.46%; height: 1.5px; }

/* 前发球线 */
.ln-serve-l { left: 35.22%; top: 0; bottom: 0; width: 1.5px; opacity: 0.9; }
.ln-serve-r { left: 64.78%; top: 0; bottom: 0; width: 1.5px; opacity: 0.9; }

/* 双打后发线 */
.ln-dbl-l { left: 5.67%; top: 0; bottom: 0; width: 1.5px; opacity: 0.6; }
.ln-dbl-r { left: 94.33%; top: 0; bottom: 0; width: 1.5px; opacity: 0.6; }

/* 球网 */
.net {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 7px;
  transform: translateX(-50%);
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px 3px),
    rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.4);
}

/* 发球区：前发球线 + 中线 + 单打边线围成的四块 */
.svc {
  position: absolute;
  width: 14.78%;
  height: 42.46%;
  background: rgba(201, 242, 74, 0.07);
}

.svc-a { left: 35.22%; top: 7.54%; }
.svc-b { left: 35.22%; top: 50%; }
.svc-c { left: 50%; top: 7.54%; }
.svc-d { left: 50%; top: 50%; }

/* 选手棋子 —— 火柴人简笔画 */
.fighter-fig {
  position: absolute;
  z-index: 6;
  width: 48px;
  height: 68px;
  transform: translate(-50%, -50%);
  transition: left 0.5s cubic-bezier(0.34, 1.4, 0.5, 1), top 0.5s cubic-bezier(0.34, 1.4, 0.5, 1);
  pointer-events: none;
}

/* 对方半场的人朝左，整体镜像 */
.fighter-fig.is-mirror {
  transform: translate(-50%, -50%) scaleX(-1);
}

.token-p { color: #86efac; filter: drop-shadow(0 0 9px rgba(82, 224, 138, 0.6)); }
.token-a { color: #fca5a5; filter: drop-shadow(0 0 9px rgba(255, 107, 107, 0.55)); }

.fm { width: 100%; height: 100%; overflow: visible; display: block; }

.fm .fm-line {
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}

.fm .fm-foot { stroke-width: 2.2; }
.fm .fm-torso { stroke-width: 3; }
.fm .fm-head-c { fill: none; stroke: currentColor; stroke-width: 2.6; }

/* 球拍 */
.fm .fm-racket {
  fill: rgba(255, 255, 255, 0.06);
  stroke: currentColor;
  stroke-width: 1.8;
}

/* 贴在拍面上的羽毛球 */
.fm .fm-skirt {
  fill: rgba(255, 255, 255, 0.28);
  stroke: currentColor;
  stroke-width: 1.2;
}
.fm .fm-skirt-line { stroke-width: 1.2; }
.fm .fm-ball { fill: currentColor; stroke: currentColor; stroke-width: 1; }

.fm .fm-shadow { fill: rgba(0, 0, 0, 0.4); stroke: none; }

/* 关节：旋转中心都是骨架上的固定点 */
.fm-lift { transform: translateY(var(--jump, 0px)); transition: transform 0.17s ease; }
.fm-root { transform-origin: 24px 34px; transform: rotate(var(--root, 0deg)); transition: transform 0.17s ease; }

.fm-hip-f { transform-origin: 24px 34px; transform: rotate(var(--hipF, 8deg)); transition: transform 0.17s ease; }
.fm-hip-b { transform-origin: 24px 34px; transform: rotate(var(--hipB, -8deg)); transition: transform 0.17s ease; }
.fm-knee-f { transform-origin: 24px 46px; transform: rotate(var(--kneeF, 8deg)); transition: transform 0.17s ease; }
.fm-knee-b { transform-origin: 24px 46px; transform: rotate(var(--kneeB, -5deg)); transition: transform 0.17s ease; }

.fm-shoulder-f { transform-origin: 24px 19px; transform: rotate(var(--shoulderF, 30deg)); transition: transform 0.17s ease; }
.fm-shoulder-b { transform-origin: 24px 19px; transform: rotate(var(--shoulderB, -32deg)); transition: transform 0.17s ease; }
.fm-elbow-f { transform-origin: 24px 29px; transform: rotate(var(--elbow, 12deg)); transition: transform 0.17s ease; }
.fm-elbow-b { transform-origin: 24px 29px; transform: rotate(var(--elbowB, 10deg)); transition: transform 0.17s ease; }
.fm-wrist { transform-origin: 24px 38px; transform: rotate(var(--wrist, -18deg)); transition: transform 0.17s ease; }

/* 击球瞬间的火花 */
.fm-spark {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(201, 242, 74, 0.5) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.fighter-fig.is-hitting .fm-spark { animation: spark 0.36s ease-out; }

@keyframes spark {
  0% { opacity: 0; transform: scale(0.4); }
  35% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* 羽毛球 */
.shuttle {
  position: absolute;
  z-index: 8;
  font-size: 19px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left 0.5s linear, top 0.5s linear;
  filter: drop-shadow(0 4px 9px rgba(0, 0, 0, 0.6));
  opacity: 0;
  left: 43.75%;
  top: 25%;
}

.shuttle.is-flying { opacity: 1; }
.shuttle.is-hit { animation: pop 0.45s ease; }

@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(1.65) rotate(22deg); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.court-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--txt-faint); }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sw-self { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24); }
.sw-foe { background: rgba(255, 255, 255, 0.04); border: 1px dashed rgba(255, 255, 255, 0.2); }
.sw-net { width: 4px; height: 13px; border-radius: 2px; background: rgba(255, 255, 255, 0.72); }
.sw-svc { width: 13px; height: 11px; border-radius: 2px; background: rgba(201, 242, 74, 0.22); border: 1px solid rgba(201, 242, 74, 0.5); }
.sw-serve { width: 13px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.62); }
.sw-single { width: 13px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.46); }
.sw-dbl { width: 13px; height: 1px; border-radius: 2px; background: rgba(255, 255, 255, 0.32); }
.court-foot .hint { margin-left: auto; }

/* ------------------------------ 来球条 ------------------------------ */
.incoming-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 11px 16px;
  border-left: 3px solid var(--orange);
}

.ib-label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--orange);
  font-weight: 700;
}

.ib-name { font-size: 15px; font-weight: 700; }
.ib-a, .ib-zone { font-size: 12.5px; color: var(--txt-dim); }
.ib-a b, .ib-zone b { font-family: var(--mono); color: var(--txt); }
.ib-from { margin-left: auto; font-size: 11.5px; color: var(--txt-faint); }

/* ------------------------------ 行动区 ------------------------------ */
.action-panel { margin-top: 14px; padding: 15px 16px 16px; }

/* A / D 模式 */
.mode-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 13px; }

.mode-btn {
  position: relative;
  text-align: left;
  padding: 11px 13px 10px 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--txt);
  cursor: pointer;
  font-family: inherit;
  transition: 0.18s;
}

.mode-btn em {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--txt-faint);
}

.mode-btn span { display: block; font-size: 14px; font-weight: 700; }
.mode-btn small { display: block; font-size: 11px; color: var(--txt-faint); margin-top: 2px; }

.mode-btn[data-mode="attack"].is-active {
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.1);
}
.mode-btn[data-mode="attack"].is-active em { color: var(--red); }

.mode-btn[data-mode="defense"].is-active {
  border-color: rgba(69, 214, 214, 0.6);
  background: rgba(69, 214, 214, 0.1);
}
.mode-btn[data-mode="defense"].is-active em { color: var(--cyan); }

.mode-btn:hover { border-color: var(--line-strong); }

/* 跑位 */
.run-box { margin-bottom: 13px; }

.run-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: rgba(155, 140, 255, 0.07);
  border: 1px solid rgba(155, 140, 255, 0.2);
}

.run-cost { font-size: 12.5px; color: var(--txt-dim); }
.run-cost b { font-family: var(--mono); color: var(--violet); }

.run-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--txt-dim);
  cursor: pointer;
  user-select: none;
}

.run-toggle input { accent-color: var(--violet); cursor: pointer; }
.run-toggle.is-off { opacity: 0.55; }

/* 来球落点高亮 */
.z.is-incoming {
  border-color: rgba(255, 161, 74, 0.8);
  background: rgba(255, 161, 74, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 161, 74, 0.35);
}

/* 对方回合时牌列置灰 */
#shotRow.is-waiting { opacity: 0.4; pointer-events: none; filter: grayscale(0.5); }

.action-head { margin-bottom: 13px; }
.action-head h4 { margin: 0 0 3px; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.action-head p { margin: 0; font-size: 12.5px; color: var(--txt-dim); }

.phase-tag {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
}

.phase-tag.attack { background: rgba(255, 107, 107, 0.16); color: var(--red); }
.phase-tag.defend { background: rgba(69, 214, 214, 0.16); color: var(--cyan); }
.phase-tag.serve { background: rgba(201, 242, 74, 0.16); color: var(--lime); }

.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }

.pcard {
  position: relative;
  text-align: left;
  padding: 11px 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--txt);
  cursor: pointer;
  font-family: inherit;
  transition: 0.18s;
  overflow: hidden;
}

.pcard::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--line-strong);
}

.pcard.pcard-a::before { background: linear-gradient(180deg, var(--red), var(--orange)); }
.pcard.pcard-d::before { background: linear-gradient(180deg, var(--cyan), var(--violet)); }

.pcard:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-2px);
}

.pcard.is-active {
  border-color: rgba(201, 242, 74, 0.6);
  background: rgba(201, 242, 74, 0.1);
  box-shadow: 0 8px 20px rgba(201, 242, 74, 0.1);
}

.pcard:disabled { opacity: 0.36; cursor: not-allowed; }

.pcard-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pcard-name { font-size: 13.5px; font-weight: 600; }
.pcard-en { font-size: 9.5px; color: var(--txt-faint); font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

.pcard-nums { display: flex; gap: 12px; margin-top: 7px; }
.pcard-nums span { font-size: 10.5px; color: var(--txt-faint); }
.pcard-nums b { font-family: var(--mono); font-size: 14px; }
.pcard-nums .v-a { color: var(--orange); }
.pcard-nums .v-d { color: var(--cyan); }
.pcard-nums .v-c { color: var(--txt-dim); }

.pcard-desc { margin: 7px 0 0; font-size: 11px; color: var(--txt-faint); line-height: 1.45; }

/* 卡面可达区域 */
.pcard-zones {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--txt-faint);
}

.zt {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  min-width: 16px;
  padding: 1px 0;
  text-align: center;
  border-radius: 4px;
  background: rgba(201, 242, 74, 0.12);
  border: 1px solid rgba(201, 242, 74, 0.28);
  color: var(--lime);
}

.zt.is-back { background: rgba(255, 161, 74, 0.14); border-color: rgba(255, 161, 74, 0.34); color: var(--orange); }

/* 防守信息条 */
.defend-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 11px;
  border-radius: var(--radius-sm);
  background: rgba(255, 161, 74, 0.08);
  border: 1px solid rgba(255, 161, 74, 0.24);
  font-size: 12.5px;
  color: var(--orange);
}

.defend-info b { font-family: var(--mono); color: var(--txt); }

.run-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--txt-dim);
  cursor: pointer;
  user-select: none;
}

.run-toggle input { accent-color: var(--violet); cursor: pointer; }
.run-toggle.is-off { opacity: 0.55; }

.cta-row { display: flex; justify-content: flex-end; margin-top: 14px; }

.btn-attack {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 30px;
  font-weight: 700;
  font-size: 15px;
  border: 0;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.92), rgba(255, 161, 74, 0.92));
  color: #2a0d08;
  box-shadow: 0 8px 22px rgba(255, 107, 107, 0.22);
}

.btn-attack.is-defend {
  background: linear-gradient(135deg, rgba(69, 214, 214, 0.92), rgba(155, 140, 255, 0.92));
  color: #071a20;
  box-shadow: 0 8px 22px rgba(69, 214, 214, 0.2);
}

.btn-attack em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.72;
  font-family: var(--mono);
}

/* ------------------------------ 战报 ------------------------------ */
.feed-panel { margin-top: 15px; padding: 14px 16px; }

.feed-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.feed-head h4 { margin: 0; font-size: 13.5px; }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 190px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  scrollbar-width: thin;
}

.feed li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--line-strong);
  animation: slidein 0.3s ease;
}

@keyframes slidein {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

.feed li .t { font-family: var(--mono); font-size: 10px; color: var(--txt-faint); flex: none; }

.feed li[data-tone="attack"] { border-left-color: var(--orange); }
.feed li[data-tone="serve"] { border-left-color: var(--lime); background: rgba(201, 242, 74, 0.1); font-weight: 600; }
.feed li[data-tone="defense"] { border-left-color: var(--cyan); }
.feed li[data-tone="move"] { border-left-color: var(--violet); }
.feed li[data-tone="stagger"] { border-left-color: var(--orange); background: rgba(255, 161, 74, 0.08); }
.feed li[data-tone="perfect"] { border-left-color: var(--cyan); background: rgba(69, 214, 214, 0.07); }
.feed li[data-tone="score"] { border-left-color: var(--green); background: rgba(82, 224, 138, 0.08); font-weight: 600; }
.feed li[data-tone="end"] { border-left-color: var(--lime); background: rgba(201, 242, 74, 0.1); font-weight: 600; }
.feed li[data-tone="turn"] { border-left-color: var(--line-strong); color: var(--txt-dim); }

/* ------------------------------ 图鉴 / 规则 ------------------------------ */
.view-head { margin-bottom: 20px; }
.view-head h2 { margin: 0 0 6px; font-size: 26px; }
.view-head p { margin: 0; color: var(--txt-dim); font-size: 14px; }

.tactics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.shot-card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: 0.22s;
  position: relative;
  overflow: hidden;
}

.shot-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; }
.shot-card[data-cat="a"]::before { background: linear-gradient(90deg, var(--orange), transparent); }
.shot-card[data-cat="d"]::before { background: linear-gradient(90deg, var(--cyan), transparent); }
.shot-card[data-cat="s"]::before { background: linear-gradient(90deg, var(--lime), transparent); }

.shot-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }

.shot-card-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.shot-card-top h3 { margin: 0; font-size: 17px; }
.shot-card-top span { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--txt-faint); font-family: var(--mono); }

.cat-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; margin-bottom: 9px; }
.cat-badge[data-cat="a"] { background: rgba(255, 161, 74, 0.14); color: var(--orange); }
.cat-badge[data-cat="d"] { background: rgba(69, 214, 214, 0.14); color: var(--cyan); }
.cat-badge[data-cat="s"] { background: rgba(201, 242, 74, 0.14); color: var(--lime); }

.shot-card p { margin: 0 0 12px; font-size: 13px; color: var(--txt-dim); min-height: 40px; }

.shot-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 11px; }
.shot-nums div { text-align: center; }
.shot-nums span { display: block; font-size: 10px; color: var(--txt-faint); }
.shot-nums b { font-family: var(--mono); font-size: 15px; color: var(--lime); }

.shot-zones {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 10.5px;
  color: var(--txt-faint);
}

.shot-zones .no-zone { color: var(--txt-faint); }

.chain-panel { margin-top: 18px; padding: 18px; }
.chain-panel h3 { margin: 0 0 6px; font-size: 17px; }
.chain-desc { margin: 0 0 16px; color: var(--txt-dim); font-size: 13.5px; }

.rules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.rule-card { padding: 18px; }
.rule-card h3 { margin: 0 0 12px; font-size: 16px; color: var(--lime); }

.rule-card ul, .rule-ol { margin: 0; padding-left: 18px; color: var(--txt-dim); font-size: 13.5px; }
.rule-card li { margin-bottom: 7px; }
.rule-card li b { color: var(--txt); }

.rule-quote {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid rgba(201, 242, 74, 0.5);
  background: rgba(201, 242, 74, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: var(--txt-dim);
}

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td, .mini-table th { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { color: var(--txt-faint); font-weight: 500; font-size: 11.5px; letter-spacing: 0.08em; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table td:last-child { text-align: right; font-family: var(--mono); color: var(--lime); }

/* ------------------------------ KO 闪现 ------------------------------ */
.ko-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
}
.ko-flash.show { animation: koPop 0.95s ease-out forwards; }
.ko-flash .ko-big {
  font-family: var(--mono);
  font-size: clamp(64px, 15vw, 150px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}
.ko-flash .ko-win { color: var(--lime); }
.ko-flash .ko-lose { color: var(--red); }
.ko-flash .ko-sub {
  font-size: clamp(15px, 3.4vw, 26px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
@keyframes koPop {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  18%  { transform: scale(1.18) rotate(-4deg); }
  34%  { transform: scale(1) rotate(0); }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.06); }
}

.v-demo { display: grid; gap: 10px; }
.v-demo svg { width: 100%; max-width: 200px; margin: 0 auto; display: block; }
.v-demo svg path {
  fill: none;
  stroke: var(--lime);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: draw 2.4s ease-in-out infinite;
}
@keyframes draw { 0% { stroke-dashoffset: 260; } 55%, 100% { stroke-dashoffset: 0; } }
.v-demo circle { fill: var(--lime); }
.v-demo text { fill: var(--txt-faint); font-size: 9px; font-family: var(--mono); }
.v-demo p { margin: 0; font-size: 12.5px; color: var(--txt-dim); text-align: center; }

/* ------------------------------ 弹层 ------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(3, 6, 12, 0.78);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.overlay.is-open { opacity: 1; pointer-events: auto; }

.dialog {
  width: min(400px, 88vw);
  padding: 30px 26px;
  border-radius: 22px;
  background: linear-gradient(165deg, #14203a, #0b1220);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  text-align: center;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.5, 1);
}

.overlay.is-open .dialog { transform: none; }
.dialog-mark { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.dialog h2 { margin: 0 0 4px; font-size: 24px; }
.dialog > p { margin: 0 0 18px; font-family: var(--mono); font-size: 26px; color: var(--lime); letter-spacing: 0.06em; }

.dialog-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.dialog-stats div:last-child:nth-child(3n + 1) { grid-column: span 3; }
.dialog-stats div { padding: 10px 6px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.dialog-stats span { display: block; font-size: 10.5px; color: var(--txt-faint); }
.dialog-stats b { font-family: var(--mono); font-size: 17px; color: var(--txt); }

/* ------------------------------ 页脚 ------------------------------ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px;
  color: var(--txt-faint);
  font-size: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.dot-sep { opacity: 0.5; }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1080px) {
  .match-grid { grid-template-columns: 1fr 1fr; }
  .court-wrap { grid-column: 1 / -1; grid-row: 1; }
  .topbar { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .match-grid { grid-template-columns: 1fr; }
  .topbar { gap: 10px; }
  .scorebar { order: 3; width: 100%; justify-content: center; }
  .topbar-right { margin-left: auto; }
  .brand-text em { display: none; }
  .rules-grid, .tactics-grid { grid-template-columns: 1fr; }
  .court { aspect-ratio: 13.4 / 6.6; }
  .z { font-size: 8px; }
}

.run-warn { font-size: 11.5px; color: var(--red); font-weight: 600; }

/* 应对策略说明 */
.resp-reason {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--cyan);
}

/* 来球类型标签 */
.ib-type {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.ib-type-smash { background: rgba(255, 107, 107, 0.18); color: #ff8f8f; }
.ib-type-drive { background: rgba(155, 140, 255, 0.18); color: #b9aeff; }
.ib-type-net { background: rgba(69, 214, 214, 0.18); color: var(--cyan); }
.ib-type-clear { background: rgba(201, 242, 74, 0.18); color: var(--lime); }

