/* ============================================================
   Diamond — 棒球场讲解画布
   design tokens：米纸底色 + 棒球缝线红 + 草皮绿 + 沙土棕
   ============================================================ */
:root {
  --paper:      #FBF8F2;
  --paper-2:    #F5F0E6;
  --panel:      #FEFCF8;
  --ink:        #1B1A17;
  --ink-2:      #55504A;
  --ink-3:      #8B837A;
  --line:       rgba(27, 26, 23, 0.10);
  --line-2:     rgba(27, 26, 23, 0.16);

  --red:        #B3362B;   /* 缝线红 · 进攻方 */
  --red-soft:   #F6E2DF;
  --def:        #2C6CA5;   /* 防守方 */
  --def-dk:     #1D4E79;
  --def-soft:   #E3EDF6;
  --grass:      #35704F;
  --grass-dk:   #244C36;
  --dirt:       #C9A57A;
  --dirt-dk:    #A9825B;
  --gold:       #A87A2C;
  --teal:       #1F7A72;
  --violet:     #6B4FA8;

  --shadow-sm:  0 1px 2px rgba(27,26,23,.06), 0 4px 14px rgba(27,26,23,.05);
  --shadow-md:  0 6px 26px rgba(27,26,23,.12);
  --radius:     14px;

  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

::selection { background: rgba(179,54,43,.15); }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 62px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 242, .88);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFFDF8 0%, #F0EADE 60%, #D8CFBC 100%);
  box-shadow: inset 0 0 0 1px rgba(27,26,23,.14), 0 0 0 3px rgba(179,54,43,.08);
  position: relative;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 2px 4px;
  border-radius: 50%;
  border-top: 1.5px solid var(--red);
  border-bottom: 1.5px solid var(--red);
  opacity: .85;
}
.brand-mark::before { transform: rotate(28deg); }
.brand-mark::after  { transform: rotate(-28deg); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .06em;
}
.brand-text i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.nav { display: flex; gap: 2px; }
.nav a {
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 7px;
  transition: .18s;
  letter-spacing: .02em;
}
.nav a:hover { background: rgba(27,26,23,.05); color: var(--ink); }

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

.ghost-btn {
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: .18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ghost-btn:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.ghost-btn svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 74px 32px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: center;
  overflow: hidden;
}

.kicker {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--red);
}
.kicker::before {
  content: "";
  display: inline-block;
  width: 18px; height: 1px;
  background: currentColor;
  vertical-align: 2px;
  margin-right: 9px;
  opacity: .55;
}

.hero h1 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 50px);
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: .01em;
}
.hero h1 .hl {
  position: relative;
  color: var(--red);
  white-space: nowrap;
}
.hero h1 .hl::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px; bottom: 4px;
  height: 12px;
  background: rgba(179,54,43,.11);
  z-index: -1;
  border-radius: 2px;
}

.lede {
  margin: 0 0 30px;
  max-width: 560px;
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-2);
}

.hero-stats {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-top: 4px;
}
.hero-stats div { display: flex; flex-direction: column; gap: 3px; }
.hero-stats b {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
}
.hero-stats b i {
  font-style: normal;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: 2px;
  font-weight: 400;
}
.hero-stats span {
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.hero-cta { display: flex; align-items: center; gap: 18px; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13px;
  padding: 11px 22px;
  border-radius: 9px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #FBF8F2;
  text-decoration: none;
  cursor: pointer;
  transition: .2s;
  letter-spacing: .02em;
}
.primary-btn:hover { background: #332C24; transform: translateY(-1px); }
.primary-btn svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.text-btn {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  padding: 2px 0 3px;
  cursor: pointer;
  transition: .18s;
}
.text-btn:hover { color: var(--red); border-color: var(--red); }

.kid-link {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 14px 20px;
  background: linear-gradient(100deg, #FFF6D6, #FFF9EC);
  border: 1px solid rgba(168,122,44,.35);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: .2s;
  max-width: 640px;
}
.kid-link:hover {
  border-color: rgba(179,54,43,.45);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.kl-badge {
  flex: 0 0 auto;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 99px;
}
.kl-txt { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.kl-txt b { color: var(--ink); display: block; font-size: 14px; }
.kl-arrow { margin-left: auto; color: var(--red); font-size: 20px; font-weight: 700; }

.hero-deco { justify-self: center; opacity: .95; }
.hero-deco svg { width: 100%; max-width: 300px; height: auto; display: block; }

/* ============================================================
   交互区（App）
   ============================================================ */
.app {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 396px;
  height: min(calc(100dvh - 62px), 880px);
  min-height: 560px;
  scroll-margin-top: 62px;
}

.stage-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 14px 16px;
  gap: 10px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 8%, #FBF8F2 0%, transparent 58%),
    linear-gradient(168deg, #F3EEE3 0%, #E7DFCE 100%);
  box-shadow: inset 0 0 0 1px rgba(27,26,23,.07), inset 0 2px 30px rgba(90, 72, 45, .1);
  cursor: grab;
  touch-action: none;
}
.stage:active { cursor: grabbing; }
.stage.tool-active { cursor: crosshair; }
#canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.stage-tag {
  position: absolute;
  top: 12px; left: 14px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: rgba(255,253,248,.78);
  border: 1px solid rgba(27,26,23,.07);
  padding: 4px 10px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.legend {
  position: absolute;
  top: 12px; right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--ink-2);
  background: rgba(255,253,248,.86);
  border: 1px solid rgba(27,26,23,.07);
  padding: 4px 6px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
}
.legend .lg-sep {
  width: 1px; height: 13px;
  background: var(--line-2);
  margin: 0 4px;
}
.lg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  color: var(--ink-2);
  background: #FFFDF8;
  border: 1px solid rgba(27,26,23,.1);
  border-radius: 99px;
  padding: 3px 9px;
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}
.lg-btn:hover { background: rgba(27,26,23,.05); }
.lg-btn i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-btn .lg-off { background: var(--red); }
.lg-btn .lg-def { background: var(--def); }
.lg-btn.on[data-side="off"] {
  background: var(--red-soft);
  border-color: rgba(179,54,43,.35);
  color: var(--red);
  font-weight: 600;
}
.lg-btn.on[data-side="def"] {
  background: var(--def-soft);
  border-color: rgba(44,108,165,.35);
  color: var(--def-dk);
  font-weight: 600;
}
.lg-mat { display: inline-flex; align-items: center; gap: 10px; padding-right: 5px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.lg-dirt  { background: var(--dirt); }
.lg-grass { background: var(--grass); }
.lg-wall  { background: #fff; box-shadow: 0 0 0 1px rgba(27,26,23,.25); }

.stage-hint {
  position: absolute;
  left: 14px; bottom: 16px;
  font-size: 10.5px;
  color: var(--ink-2);
  background: rgba(255,253,248,.78);
  border: 1px solid rgba(27,26,23,.06);
  padding: 5px 11px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity .5s;
}
.stage-hint.fade { opacity: 0; }

.tool-mode {
  position: absolute;
  top: 12px; right: 14px;
  font-size: 11px;
  color: #fff;
  background: rgba(179, 54, 43, .92);
  padding: 5px 10px;
  border-radius: 99px;
  pointer-events: none;
}

/* Toolbar */
.stage-tools {
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: rgba(255, 253, 249, .93);
  border: 1px solid rgba(27,26,23,.09);
  border-radius: 13px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}
.tool svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.tool:hover { background: rgba(27,26,23,.055); color: var(--ink); }
.tool.active { background: var(--ink); color: #FBF8F2; }
.tool.icon-only { padding: 0 8px; }
.tool-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }

/* Timeline */
.timeline {
  flex: 0 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px 13px;
  box-shadow: var(--shadow-sm);
}
.tl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.tl-title {
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: .05em;
  color: var(--ink-2);
}
.tl-actions { display: flex; gap: 6px; }
.tl-btn {
  font: inherit;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: .16s;
}
.tl-btn:hover { background: var(--paper-2); color: var(--ink); }
.tl-track { display: flex; gap: 6px; }
.tl-step {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  padding: 7px 9px 8px;
  text-align: left;
  font: inherit;
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  overflow: hidden;
  transition: .2s;
}
.tl-step:hover { border-color: var(--line-2); }
.tl-idx {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: .06em;
}
.tl-name {
  display: block;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-step.done .tl-name { color: var(--ink); }
.tl-step.done .tl-idx::after { content: " ✓"; color: var(--teal); }
.tl-step.active {
  background: #fff;
  border-color: rgba(179,54,43,.42);
  box-shadow: 0 2px 10px rgba(179,54,43,.14);
}
.tl-step.active .tl-name { color: var(--ink); font-weight: 600; }
.tl-step.active::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--red), #E08A7E);
}

/* ============================================================
   Panel
   ============================================================ */
.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.tabs {
  flex: 0 0 auto;
  height: 46px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.tab {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 10px;
  cursor: pointer;
  transition: .18s;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--red); font-weight: 600; }
.tab em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  background: var(--paper-2);
  border-radius: 99px;
  padding: 1px 5px;
  margin-left: 2px;
}

.pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Messages */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 18px 8px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(27,26,23,.14);
  border-radius: 9px;
  border: 2px solid var(--panel);
}

.msg { margin-bottom: 18px; animation: fadeUp .34s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.msg.assistant .msg-body {
  font-size: 13.5px;
  line-height: 1.82;
  color: var(--ink);
  letter-spacing: .005em;
}
.msg-body p { margin: 0 0 9px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body strong { font-weight: 600; }
.msg-body em { font-style: normal; color: var(--red); }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.kind {
  font-size: 10px;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 500;
}
.kind.fact   { color: #8A5F14; background: #F3E6CD; }
.kind.obs    { color: #14615B; background: #DCEFEC; }
.kind.interp { color: #4E3684; background: #E9E2F7; }
.kind.rule   { color: #8E2C22; background: var(--red-soft); }
.msg-src {
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.msg-src::before { content: "来源 "; opacity: .7; }

.msg.user { display: flex; justify-content: flex-end; }
.msg.user .msg-body {
  max-width: 84%;
  font-size: 13px;
  line-height: 1.6;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 13px 13px 3px 13px;
  padding: 9px 13px;
  color: var(--ink);
}

.msg.system {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: .01em;
  border-left: 2px solid var(--red-soft);
  padding-left: 9px;
  line-height: 1.65;
}
.msg.system b { font-weight: 600; color: var(--ink-2); font-family: var(--sans); }

.msg.pending .msg-body { color: var(--ink-3); font-size: 12.5px; }
.msg.pending .dots::after {
  content: "";
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; }
}

/* 图卡：好球带 / 计分板 / 双杀 */
.mcard {
  margin: 10px 0 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 12px 13px;
  box-shadow: var(--shadow-sm);
}
.mcard-h {
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.sz-wrap { display: flex; gap: 14px; align-items: center; }
.sz {
  position: relative;
  width: 96px; height: 116px;
  border: 1.5px solid var(--red);
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(179,54,43,.16) 38px 39px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(179,54,43,.16) 31px 32px),
    #FDFBF6;
  flex: 0 0 auto;
}
.sz i {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink);
  opacity: .82;
}
.sz i.b { background: var(--red); }
.sz i.g { background: var(--grass); }
.plate {
  width: 44px; height: 10px;
  margin-top: -1px;
  background: #fff;
  border: 1.5px solid var(--ink-3);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}
.sz-legend { font-size: 11px; color: var(--ink-2); line-height: 1.75; }
.sz-legend b { display: block; font-size: 12px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }
.sz-legend span { display: block; }
.sz-legend i {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}

.quick { display: grid; gap: 6px; margin-top: 10px; }
.quick button {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font: inherit;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: .18s;
}
.quick button:hover {
  border-color: rgba(179,54,43,.45);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.quick button b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.quick button span { font-size: 11px; color: var(--ink-3); }

.lineup {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}.lineup div {
  background: var(--paper-2);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.lineup div b {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  font-weight: 600;
}

/* Composer */
.composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 10px 14px 14px;
  background: var(--panel);
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 9px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  padding: 5px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: .16s;
}
.chip:hover { background: var(--paper-2); color: var(--ink); border-color: rgba(179,54,43,.45); }

#form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 4px 4px 4px 13px;
  transition: .18s;
}
#form:focus-within { border-color: rgba(179,54,43,.55); box-shadow: 0 0 0 3px rgba(179,54,43,.09); }
#input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  padding: 8px 0;
}
#input::placeholder { color: var(--ink-3); }
#send {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: .16s;
}
#send:hover { background: #332C24; }
#send svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Events */
.pane-events { overflow: hidden; }
.ev-note {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-3);
  padding: 11px 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.ev-note code {
  font-family: var(--mono);
  font-size: 10.5px;
  background: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--ink-2);
}
.events-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 14px 20px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
}
.events-list::-webkit-scrollbar { width: 8px; }
.events-list::-webkit-scrollbar-thumb {
  background: rgba(27,26,23,.14);
  border-radius: 9px;
  border: 2px solid var(--panel);
}
.ev { padding: 6px 0 7px; border-bottom: 1px dashed rgba(27,26,23,.08); }
.ev-head { display: flex; align-items: baseline; gap: 7px; }
.ev-type {
  flex: 0 0 auto;
  font-size: 9.5px;
  letter-spacing: .03em;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink-2);
}
.ev-type.custom { background: #FDECE9; color: var(--red); }
.ev-type.text   { background: #E9F0FB; color: #2C5CA8; }
.ev-type.run    { background: #E6F3EA; color: #2E7A4C; }
.ev-type.state  { background: #F0EDF9; color: var(--violet); }
.ev-name { color: var(--ink); font-size: 10.5px; }
.ev-time { margin-left: auto; color: var(--ink-3); font-size: 9.5px; }
.ev-body { color: var(--ink-3); font-size: 10.5px; margin-top: 3px; word-break: break-word; }

/* Gloss */
.pane-gloss { overflow-y: auto; }
.gloss-list { padding: 6px 16px 24px; }
.gloss-item {
  padding: 11px 0;
  border-bottom: 1px dashed rgba(27,26,23,.09);
}
.gloss-item dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.gloss-item dt em {
  font-style: italic;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.gloss-item dd {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
}

/* ============================================================
   内容区
   ============================================================ */
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 76px 32px 72px;
  scroll-margin-top: 62px;
}
.section.alt {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}
.section.alt > * {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 32px;
  padding-right: 32px;
}

.sec-head { margin-bottom: 38px; max-width: 620px; }
.sec-head h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(23px, 2.6vw, 31px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.4;
}
.sec-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-2);
}

/* 规则卡 */
/* 攻守对照条 */
.side-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}
.sb-item {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.sb-item b { display: block; font-size: 13px; margin-bottom: 5px; letter-spacing: .02em; }
.sb-item p { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--ink-2); }
.sb-item p b { display: inline; font-size: inherit; color: var(--ink); }
.sb-dot {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}
.sb-def { background: rgba(44,108,165,.06); border-color: rgba(44,108,165,.22); }
.sb-def .sb-dot { background: var(--def); }
.sb-def b { color: var(--def-dk); }
.sb-off { background: rgba(179,54,43,.05); border-color: rgba(179,54,43,.2); }
.sb-off .sb-dot { background: var(--red); }
.sb-off b { color: var(--red); }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  box-shadow: var(--shadow-sm);
  transition: .22s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card.wide { grid-column: 1 / -1; }
.card-idx {
  position: absolute;
  top: 20px; right: 22px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .1em;
  opacity: .7;
}
.card h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .02em;
}
.card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
}
.card-note {
  margin-top: 12px;
  flex: 0 0 auto;
  padding-left: 11px;
  border-left: 2px solid var(--red-soft);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-3);
}

.mini-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.mini-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(27,26,23,.07);
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list b { min-width: 44px; font-weight: 600; color: var(--ink); }
.mini-list span { color: var(--ink-2); }

.strike-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}
.sz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 54px; height: 62px;
  border: 1.5px solid var(--red);
  border-radius: 2px;
  overflow: hidden;
  flex: 0 0 auto;
}
.sz-grid i { border-right: 1px solid rgba(179,54,43,.18); border-bottom: 1px solid rgba(179,54,43,.18); }
.sz-grid i:nth-child(3n) { border-right: 0; }
.sz-grid i:nth-child(n+7) { border-bottom: 0; }
.sz-grid i.hot { background: rgba(179,54,43,.12); }
.strike-card span { font-size: 11px; line-height: 1.65; color: var(--ink-3); }

.count-row { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.cnt-pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.cnt-pill.hot { background: var(--red); color: #fff; border-color: var(--red); }

.flow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.flow-node {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 15px;
  border-radius: 9px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
}
.flow-node em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: .06em;
}
.flow-node.score {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.flow-node.score em { color: rgba(255,255,255,.72); }
.flow-arrow { color: var(--ink-3); font-size: 13px; }

/* 九人 */
.side-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12px;
  line-height: 1.6;
}
.side-tag i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.side-tag b { font-weight: 600; }
.side-def { background: var(--def-soft); color: var(--def-dk); }
.side-def i { background: var(--def); }
.side-def b { color: var(--def-dk); }

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.pos {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
  cursor: pointer;
  transition: .2s;
}
.pos:hover { border-color: rgba(44,108,165,.4); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.pos-n {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: var(--def);
  margin-top: 1px;
}
.pos-body { min-width: 0; }
.pos-body b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.pos-body em {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  margin-bottom: 5px;
}
.pos-body p { margin: 0; font-size: 11.5px; line-height: 1.65; color: var(--ink-2); }

/* 数据 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--red);
  letter-spacing: .02em;
}
.stat span { display: block; font-size: 12px; color: var(--ink); margin-top: 2px; }
.stat em {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  margin: 7px 0 9px;
  letter-spacing: .02em;
}
.stat p { margin: 0; font-size: 11.5px; line-height: 1.65; color: var(--ink-2); }

/* 联赛 */
.league-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.league {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 3px;
}
.league b {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
}
.league span { font-size: 12.5px; color: var(--ink); }
.league em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.world-note {
  margin: 26px 0 0;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-2);
  max-width: 720px;
  padding-left: 13px;
  border-left: 2px solid var(--line-2);
}

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  padding: 34px 32px 44px;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.foot div { display: flex; flex-direction: column; gap: 2px; }
.foot b {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .06em;
  font-weight: 600;
}
.foot span { font-size: 11.5px; color: var(--ink-3); }
.foot p {
  margin: 0;
  font-size: 11px;
  line-height: 1.8;
  color: var(--ink-3);
  text-align: right;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(320px, 52vh) minmax(0, 1fr);
    height: auto;
  }
  .stage-wrap { padding: 10px 10px 6px; height: min(58vh, 520px); }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 420px;
    max-height: 62vh;
  }
  .legend { top: 8px; right: 8px; bottom: auto; padding: 3px 4px; font-size: 10px; }
  .legend .lg-mat, .legend .lg-sep { display: none; }
  .lg-btn { padding: 3px 8px; }
  .tool span { display: none; }
  .tool { padding: 0 8px; }
  .stage-hint { display: none; }
  .hero { grid-template-columns: 1fr; padding: 52px 24px 40px; }
  .hero-deco { display: none; }
  .pos-grid, .league-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: 56px; padding: 0 16px; gap: 12px; }
  .brand-text i { display: none; }
  .ghost-btn { padding: 5px 9px; font-size: 11.5px; }
  .section { padding: 52px 20px 48px; }
  .section.alt > * { padding-left: 20px; padding-right: 20px; }
  .rule-grid { grid-template-columns: 1fr; }
  .pos-grid, .league-list, .stat-grid { grid-template-columns: 1fr; }
  .foot { padding: 28px 20px 36px; flex-direction: column; gap: 16px; }
  .foot p { text-align: left; }
  .hero-stats { gap: 20px; }
  .hero-stats b { font-size: 19px; }
  .stage-wrap { height: min(52vh, 400px); }
  .tl-step { padding: 6px 6px 7px; }
  .tl-name { font-size: 10.5px; }
  .tl-track { overflow-x: auto; }
  .tl-step { min-width: 88px; }
}
