:root {
  color-scheme: dark;
  --future-bg: #071017;
  --future-panel: rgba(10, 22, 28, .90);
  --future-panel-solid: #0d1a20;
  --future-edge: rgba(185, 218, 216, .17);
  --future-text: #f3f7f5;
  --future-muted: #9fb0b2;
  --future-faint: #65777b;
  --future-blue: #79e6db;
  --future-blue-soft: rgba(121, 230, 219, .13);
  --future-gold: #f1c66b;
  --future-gold-soft: rgba(241, 198, 107, .13);
  --future-red: #ef665c;
  --future-red-soft: rgba(239, 102, 92, .13);
  --future-played: #f3f7f5;
}

.future-product {
  color: var(--future-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.future-product body {
  background-color: var(--future-bg);
}

.future-product .panel {
  border-color: var(--future-edge);
  background-color: var(--future-panel);
}

.future-appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 54px;
  color: var(--future-text);
}

.future-home,
.future-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.future-home {
  flex: 0 0 44px;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--future-edge);
  border-radius: 12px;
  background: rgba(12, 28, 34, .82);
}

.future-home:focus-visible,
.future-brand:focus-visible,
.future-game-nav a:focus-visible {
  outline: 3px solid var(--future-blue);
  outline-offset: 3px;
}

.future-brand {
  gap: 10px;
  min-height: 44px;
}

.future-brand-mark {
  position: relative;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(121, 230, 219, .48);
  border-radius: 9px;
  box-shadow: inset 0 0 18px rgba(121, 230, 219, .11);
}

.future-brand-mark::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--future-blue);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-35deg);
}

.future-brand-copy {
  min-width: 0;
}

.future-brand-copy b,
.future-brand-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.future-brand-copy b {
  font-size: 13px;
  letter-spacing: .08em;
}

.future-brand-copy small {
  margin-top: 2px;
  color: var(--future-muted);
  font-size: 10px;
}

.future-game-nav {
  display: flex;
  gap: 5px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--future-edge);
  border-radius: 12px;
  background: rgba(7, 16, 22, .64);
}

.future-game-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--future-muted);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.future-game-nav a[aria-current="page"] {
  color: var(--future-text);
  background: var(--future-blue-soft);
  box-shadow: inset 0 0 0 1px rgba(121, 230, 219, .2);
}

.future-truth {
  flex: 0 0 auto;
  color: var(--future-muted);
  font-size: 10.5px;
  letter-spacing: .04em;
}

.future-panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.future-panel-heading > div:first-child {
  min-width: 0;
}

.future-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--future-blue);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.future-panel-heading h1,
.future-panel-heading h2 {
  margin: 0;
  color: var(--future-text);
  font-size: 15px;
  font-weight: 690;
}

.future-description {
  margin: 4px 0 0;
  color: var(--future-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.future-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--future-muted);
  font-size: 9.5px;
}

.future-legend-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.future-legend-key::before {
  content: "";
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.future-legend-key[data-kind="option"] { color: #74858b; }
.future-legend-key[data-kind="selected"] { color: var(--future-blue); }
.future-legend-key[data-kind="played"] { color: var(--future-played); }
.future-legend-key[data-kind="engine"] { color: var(--future-gold); }
.future-legend-key[data-kind="effect"] { color: var(--future-red); }
.future-legend-key[data-kind="engine"]::before {
  background: repeating-linear-gradient(
    90deg,
    currentColor 0 5px,
    transparent 5px 8px
  );
}

.preview-depth-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 9px;
  width: fit-content;
  max-width: 100%;
  margin-top: 9px;
  padding: 6px 8px 6px 11px;
  border: 1px solid rgba(121, 230, 219, .2);
  border-radius: 12px;
  color: var(--future-text);
  background:
    linear-gradient(90deg, rgba(121, 230, 219, .08), transparent 58%),
    rgba(5, 14, 19, .5);
}

.preview-depth-control > span {
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .04em;
}

.preview-depth-control select {
  min-width: 82px;
  min-height: 44px;
  padding: 6px 28px 6px 10px;
  border: 1px solid rgba(211, 175, 100, .42);
  border-radius: 9px;
  color: #fff2c8;
  background: rgba(40, 31, 20, .88);
  font: inherit;
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
}

.preview-depth-control select:focus-visible {
  outline: 2px solid var(--future-blue);
  outline-offset: 2px;
}

.preview-depth-control small {
  color: var(--future-muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.future-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border-top: 1px solid var(--future-edge);
  background:
    linear-gradient(90deg, rgba(121, 230, 219, .055), transparent 44%),
    rgba(5, 14, 19, .58);
}

.future-context-copy {
  min-width: 0;
}

.future-context-label {
  display: block;
  margin-bottom: 3px;
  color: var(--future-blue);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.future-context-title,
.future-context-detail {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.future-context-title {
  color: var(--future-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.future-context-detail {
  margin-top: 2px;
  color: var(--future-muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.future-context-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.future-context button,
button.future-commit {
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid rgba(121, 230, 219, .32);
  border-radius: 10px;
  color: #e9fffb;
  background: rgba(34, 91, 82, .48);
  cursor: pointer;
}

.future-context button:disabled,
button.future-commit:disabled {
  opacity: .38;
  cursor: default;
}

.future-effects {
  display: flex;
  min-width: 0;
  gap: 6px;
  margin-top: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.future-effect {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--future-edge);
  border-radius: 999px;
  color: var(--future-muted);
  background: rgba(19, 31, 36, .72);
  font-size: 9.5px;
}

.future-effect[data-kind="capture"],
.future-effect[data-kind="check"],
.future-effect[data-kind="threat"],
.future-effect[data-kind="exposure"] {
  color: #ffb1aa;
  border-color: rgba(239, 102, 92, .28);
  background: var(--future-red-soft);
}

.future-effect[data-kind="defense"] {
  color: #baf5e9;
  border-color: rgba(121, 230, 219, .25);
  background: var(--future-blue-soft);
}

.future-effects[data-reveal-state="hidden"] {
  visibility: hidden;
}

.future-effects[data-reveal-state="revealing"] .future-effect {
  animation: future-effect-reveal .24s cubic-bezier(.2, .76, .26, 1) both;
}

.future-effects[data-reveal-state="revealing"] .future-effect:nth-child(2) { animation-delay: 70ms; }
.future-effects[data-reveal-state="revealing"] .future-effect:nth-child(3) { animation-delay: 140ms; }
.future-effects[data-reveal-state="revealing"] .future-effect:nth-child(4) { animation-delay: 210ms; }

@keyframes future-effect-reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/*
 * 第一步是用户已经选定的动作；从第二步开始只能是条件分支。回应条完整列出
 * 第一步走后局面的全部合法着，金色只标引擎建议，蓝色才表示用户明确选中。
 */
.future-reply-panel {
  min-width: 0;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--future-edge);
}

.future-reply-panel[hidden] {
  display: none;
}

.future-reply-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--future-muted);
  font-size: 9.5px;
}

.future-reply-heading b {
  color: var(--future-text);
  font-size: 10.5px;
}

[data-future-reply-list] {
  display: flex;
  gap: 6px;
  min-width: 0;
  padding: 1px 1px 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 230, 219, .28) transparent;
}

/* 国际象棋把 data 属性放在横向选项轨道上；中国象棋把它放在整块面板上。 */
[data-future-map][data-game="xiangqi"] [data-future-reply-list] {
  display: block;
  overflow: visible;
}

[data-future-reply-option] {
  flex: 0 0 auto;
  min-width: 104px;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--future-edge);
  border-radius: 9px;
  color: var(--future-text);
  background: rgba(15, 29, 36, .82);
  text-align: left;
  cursor: pointer;
}

/* 回应项在路线语境栏里仍应保持中性；青色只留给用户明确选中的分支。 */
.future-context [data-future-reply-option] {
  border-color: var(--future-edge);
  color: var(--future-text);
  background: rgba(15, 29, 36, .82);
}

[data-future-reply-option] b,
[data-future-reply-option] small {
  display: block;
}

[data-future-reply-option] b {
  font-size: 11px;
}

[data-future-reply-option] small {
  margin-top: 2px;
  color: var(--future-muted);
  font-size: 8.5px;
}

[data-future-reply-option][data-engine-suggested="true"] {
  border-color: rgba(241, 198, 107, .58);
  background: var(--future-gold-soft);
  box-shadow: inset 3px 0 0 var(--future-gold);
}

[data-future-reply-option][data-selected="true"] {
  border-color: var(--future-blue);
  background: var(--future-blue-soft);
  box-shadow: inset 3px 0 0 var(--future-blue);
}

[data-future-reply-option]:focus-visible {
  outline: 3px solid var(--future-blue);
  outline-offset: 2px;
}

[data-future-map][data-phase="thinking"] [data-future-node] {
  opacity: .46;
}

[data-future-node][data-future-selected="true"],
[data-future-node]:not([data-future-selected])[data-selected="true"] {
  border-color: var(--future-blue) !important;
}

[data-future-node][data-engine="true"] {
  box-shadow: inset 0 0 0 1px rgba(241, 198, 107, .36);
}

[data-future-node][data-effect~="capture"]:not([data-future-selected="true"]):not([data-selected="true"]),
[data-future-node][data-effect~="check"]:not([data-future-selected="true"]):not([data-selected="true"]),
[data-future-node][data-effect~="exposure"]:not([data-future-selected="true"]):not([data-selected="true"]) {
  border-color: rgba(239, 102, 92, .48) !important;
}

/*
 * 两种棋共用的路线预演协议：运动棋子只存在于当前一拍，静态路径则保留到
 * 最终投影，方便用户把“我选的一步 → 我主动选择的假设回应”和停住的盘面对应起来。
 */
[data-future-preview="active"] [data-future-motion-piece="true"] {
  will-change: transform, opacity;
}

[data-future-preview="active"] [data-future-preview-step] {
  pointer-events: none;
}

@media (max-width: 760px) {
  .future-appbar {
    gap: 9px;
    min-height: 44px;
  }

  .future-home {
    border-radius: 10px;
  }

  .future-brand-mark,
  .future-truth {
    display: none;
  }

  .future-brand-copy b {
    font-size: 12px;
  }

  .future-brand-copy small {
    font-size: 9px;
  }

  .future-game-nav {
    gap: 3px;
    padding: 0 3px;
  }

  .future-game-nav a {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 10px;
  }

  .future-context {
    grid-template-columns: minmax(0, 1fr);
  }

  .future-context-actions {
    width: 100%;
  }

  .future-context-actions button {
    flex: 1 1 auto;
  }

  .preview-depth-control {
    width: 100%;
  }

  .preview-depth-control small {
    flex: 1 1 150px;
  }

  [data-future-reply-option] {
    min-width: 118px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .future-product * {
    scroll-behavior: auto !important;
  }

  [data-future-preview="active"] [data-future-motion-piece="true"] {
    animation: none !important;
    transition: none !important;
    will-change: auto;
  }

  .future-effects[data-reveal-state="revealing"] .future-effect {
    animation: none !important;
  }
}
