/* 互动小模拟器样式。所有类名以 wg- 开头；字体继承页面。 */
.wg-root {
  --wg-ink: #2b2b2b;
  --wg-muted: #6b6b6b;
  --wg-line: #d9d6cf;
  --wg-bg: #faf9f6;
  --wg-accent: #3f6491;
  --wg-alert: #b5523b;
  --wg-name: 4.6em;
  font: inherit;
  color: var(--wg-ink);
  background: var(--wg-bg);
  border: 1px solid var(--wg-line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 1.2em 0;
  max-width: 640px;
  box-sizing: border-box;
  line-height: 1.6;
}
.wg-root *, .wg-root *::before, .wg-root *::after { box-sizing: border-box; }

/* 去处配色（克制的浅色，深色文字） */
.wg-c-jia { background: #a9c1dc; }
.wg-c-yi { background: #b3d3ae; }
.wg-c-bing { background: #e6cd98; }
.wg-c-ding { background: #d8bfd2; }
.wg-c-none { background: #e7e4dd; color: var(--wg-muted); }

.wg-head { margin-bottom: 10px; }
.wg-title { font-weight: 600; font-size: 1.05em; }
.wg-sub { color: var(--wg-muted); font-size: 0.92em; }

.wg-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.wg-btn {
  font: inherit;
  font-size: 0.95em;
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--wg-accent);
  background: #fff;
  color: var(--wg-accent);
  cursor: pointer;
  touch-action: manipulation;
}
.wg-btn:hover { background: #eef2f7; }
.wg-btn:focus-visible { outline: 2px solid var(--wg-accent); outline-offset: 2px; }
.wg-btn.wg-primary { background: var(--wg-accent); color: #fff; }
.wg-btn.wg-primary:hover { background: #355579; }
.wg-btn.wg-ghost { border-color: var(--wg-line); color: var(--wg-muted); }

.wg-last { margin: 6px 0; font-weight: 600; }
.wg-last.wg-diff { color: var(--wg-alert); }
.wg-note { color: var(--wg-muted); font-size: 0.88em; margin-top: 8px; }
.wg-stat { font-size: 0.95em; margin-top: 4px; }
.wg-theory { color: var(--wg-accent); }

.wg-swatch {
  display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px;
  margin-right: 0.35em; vertical-align: -0.05em;
}

/* 签盒：频率条 */
.wg-bars { margin: 6px 0; }
.wg-bar-row {
  display: grid;
  grid-template-columns: 6.6em 1fr;
  grid-template-areas: "label track" ". nums";
  column-gap: 8px;
  margin: 6px 0;
  align-items: center;
}
.wg-bar-label { grid-area: label; white-space: nowrap; font-size: 0.92em; }
.wg-bar-track {
  grid-area: track; position: relative; height: 16px;
  background: #fff; border: 1px solid var(--wg-line); border-radius: 3px;
}
.wg-bar-fill { height: 100%; width: 0; border-radius: 2px; transition: width 0.25s ease; }
.wg-bar-mark {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px;
  background: var(--wg-ink);
}
.wg-bar-nums { grid-area: nums; display: flex; gap: 1em; font-size: 0.85em; color: var(--wg-muted); }
.wg-chance { color: var(--wg-ink); }
.wg-legend { font-size: 0.85em; color: var(--wg-muted); display: flex; align-items: center; gap: 6px; }
.wg-legend-mark { display: inline-block; width: 2px; height: 1em; background: var(--wg-ink); }

/* 两条绳子 */
.wg-ropes { margin: 6px 0 4px; }
.wg-rope-area { position: relative; cursor: crosshair; padding-top: 14px; }
.wg-rope-row { display: flex; align-items: center; gap: 0.5em; margin: 6px 0; }
.wg-rope-name { flex: none; width: var(--wg-name); font-size: 0.88em; text-align: right; color: var(--wg-muted); }
.wg-rope {
  flex: 1; display: flex; height: 30px; border-radius: 4px; overflow: hidden;
  border: 1px solid #bdb8ae;
}
.wg-seg {
  height: 100%; font-size: 0.78em; line-height: 28px; text-align: center;
  overflow: hidden; white-space: nowrap; text-overflow: clip;
  border-right: 1px solid rgba(255, 255, 255, 0.9);
}
.wg-seg:last-child { border-right: 0; }
.wg-ticks { flex: 1; position: relative; height: 1.3em; }
.wg-tick {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 0.75em; color: var(--wg-muted); line-height: 1;
}
.wg-tick::before {
  content: ""; display: block; width: 1px; height: 5px; background: #bdb8ae; margin: 0 auto 2px;
}
.wg-lane {
  position: absolute; left: calc(var(--wg-name) + 0.5em); right: 0; top: 0; bottom: 1.6em;
  pointer-events: none;
}
.wg-cursor {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--wg-accent);
}
.wg-cursor.wg-cursor-diff { background: var(--wg-alert); }
.wg-utag {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  font-size: 0.75em; font-style: italic; font-weight: 600; line-height: 1;
  color: inherit;
}
.wg-cursor .wg-utag { color: var(--wg-accent); }
.wg-cursor.wg-cursor-diff .wg-utag { color: var(--wg-alert); }

/* 计时器赛跑 */
.wg-timers { display: grid; gap: 10px; margin: 8px 0; }
.wg-tblock { background: #fff; border: 1px solid var(--wg-line); border-radius: 6px; padding: 8px 10px; }
.wg-tblock-head { display: flex; justify-content: space-between; font-size: 0.92em; margin-bottom: 4px; }
.wg-tblock-name { font-weight: 600; }
.wg-twin { color: var(--wg-accent); font-weight: 600; }
.wg-trow {
  display: grid; grid-template-columns: 4.8em 1fr 4.6em; gap: 8px;
  align-items: center; margin: 4px 0; font-size: 0.88em;
}
.wg-tlabel { white-space: nowrap; }
.wg-ttrack { position: relative; height: 12px; background: #f1efea; border-radius: 3px; }
.wg-tfill { height: 100%; width: 0; border-radius: 3px; opacity: 0.85; }
.wg-tbell {
  position: absolute; top: -5px; width: 0; height: 0; margin-left: -5px;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 7px solid var(--wg-muted);
}
.wg-tbell.wg-tbell-far { border-top-color: #bdb8ae; }
.wg-tinfo { color: var(--wg-muted); font-size: 0.92em; text-align: right; white-space: nowrap; }
.wg-trow.wg-off { opacity: 0.45; }
.wg-trow.wg-won .wg-tlabel { font-weight: 700; }
.wg-trow.wg-won .wg-tbell { border-top-color: var(--wg-accent); }
.wg-trow.wg-won .wg-ttrack { box-shadow: 0 0 0 1px var(--wg-accent); }

@media (max-width: 420px) {
  .wg-root { padding: 12px 10px; --wg-name: 3.6em; }
  .wg-bar-row { grid-template-columns: 5.8em 1fr; }
  .wg-trow { grid-template-columns: 4.2em 1fr 4em; gap: 6px; }
  .wg-btn { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .wg-bar-fill { transition: none; }
}
