.bt-game {
  display: grid;
  gap: 14px;
}

.bt-topline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bt-stat {
  min-width: 0;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px 10px;
}

.bt-stat span {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.25;
}

.bt-stat strong {
  display: block;
  min-height: 24px;
  margin-top: 2px;
  color: #17202a;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.bt-prompt,
.bt-status {
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
}

.bt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(270px, 0.9fr);
  grid-template-areas:
    "table tree"
    "place tree";
  gap: 12px;
  align-items: stretch;
}

.bt-table,
.bt-placement,
.bt-tree-panel {
  min-width: 0;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(20, 31, 50, 0.06);
}

.bt-table {
  grid-area: table;
  display: grid;
  gap: 10px;
}

.bt-placement {
  grid-area: place;
  display: grid;
  gap: 10px;
}

.bt-tree-panel {
  grid-area: tree;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.bt-section-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.bt-section-head span {
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.bt-section-head strong {
  min-width: 0;
  color: #0f766e;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: right;
}

.bt-preorder,
.bt-belt,
.bt-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.bt-preorder {
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, #eef7ff, #f8fafc);
  border: 1px solid #d5e2ef;
}

.bt-belt {
  position: relative;
  padding: 10px;
  border: 1px solid #d9c9a3;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.94), rgba(255, 247, 237, 0.94)),
    repeating-linear-gradient(90deg, rgba(146, 64, 14, 0.08) 0, rgba(146, 64, 14, 0.08) 10px, transparent 10px, transparent 20px);
}

.bt-token,
.bt-candidate,
.bt-socket,
.bt-btn {
  font: inherit;
}

.bt-token {
  min-width: 48px;
  min-height: 48px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 5px 8px;
  touch-action: manipulation;
}

.bt-token span {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.bt-pre-token.bt-is-armed {
  border-color: #0f766e;
  background: #d7f4ef;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.bt-pre-token.bt-is-selected,
.bt-token.bt-is-used {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.bt-token.bt-is-muted {
  opacity: 0.56;
}

.bt-belt-token.bt-is-armed {
  border-color: #d28c23;
  background: #fff7ed;
}

.bt-belt-token.bt-is-left {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.bt-belt-token.bt-is-right {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
}

.bt-belt-token.bt-is-blade {
  border-color: #17202a;
  background: #17202a;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 32, 42, 0.16);
}

.bt-split-read {
  min-height: 36px;
  border: 1px dashed #b8c0cc;
  border-radius: 8px;
  background: #fbfcfe;
  color: #475467;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bt-root-pad {
  min-height: 66px;
  border: 2px solid #0f766e;
  border-radius: 8px;
  background: #d7f4ef;
  color: #0f514b;
  display: grid;
  place-items: center;
  padding: 8px;
}

.bt-root-pad span,
.bt-socket span {
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.bt-root-pad strong {
  color: #0f514b;
  font-size: 28px;
  line-height: 1;
}

.bt-sockets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-socket {
  min-width: 0;
  min-height: 74px;
  border: 2px dashed #aeb8c5;
  border-radius: 8px;
  background: #fbfcfe;
  color: #17202a;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  touch-action: manipulation;
}

.bt-socket strong {
  font-size: 24px;
  line-height: 1;
}

.bt-socket.bt-is-armed {
  border-color: #d28c23;
  background: #fff7ed;
}

.bt-socket.bt-is-filled {
  border-style: solid;
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.bt-socket.bt-is-empty {
  background: #f2f4f7;
  color: #667085;
}

.bt-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
}

.bt-candidate {
  min-width: 0;
  min-height: 48px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
  touch-action: manipulation;
}

.bt-candidate span {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.bt-candidate.bt-is-held {
  border-color: #d28c23;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(210, 140, 35, 0.16);
}

.bt-candidate.bt-is-used,
.bt-candidate:disabled {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
  opacity: 0.8;
  cursor: default;
}

.bt-candidate-note {
  grid-column: 1 / -1;
  min-height: 48px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fbfcfe;
  color: #667085;
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.bt-tree-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 58px 28px 58px 28px 58px;
  gap: 0 8px;
  min-height: 230px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fbfcfe, #f8fafc),
    repeating-linear-gradient(0deg, rgba(102, 112, 133, 0.06) 0, rgba(102, 112, 133, 0.06) 1px, transparent 1px, transparent 20px);
  border: 1px solid #e1e6ee;
}

.bt-tree-node {
  z-index: 2;
  min-width: 0;
  min-height: 52px;
  border: 2px solid #d0d5dd;
  border-radius: 8px;
  background: #ffffff;
  color: #98a2b3;
  display: grid;
  place-items: center;
  padding: 5px;
}

.bt-tree-node span {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.bt-tree-node strong {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1;
}

.bt-tree-node.bt-is-visible {
  border-color: #7aa7c7;
  background: #eef7ff;
  color: #164e63;
}

.bt-tree-node.bt-is-current {
  border-color: #d28c23;
  background: #fff7ed;
  color: #92400e;
}

.bt-tree-node.bt-is-built {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.bt-node-3 {
  grid-column: 2 / 4;
  grid-row: 1;
}

.bt-node-9 {
  grid-column: 1 / 3;
  grid-row: 3;
}

.bt-node-20 {
  grid-column: 3 / 5;
  grid-row: 3;
}

.bt-node-15 {
  grid-column: 3 / 4;
  grid-row: 5;
}

.bt-node-7 {
  grid-column: 4 / 5;
  grid-row: 5;
}

.bt-edge {
  z-index: 1;
  height: 3px;
  align-self: center;
  background: #d0d5dd;
  opacity: 0.45;
}

.bt-edge.bt-is-visible {
  background: #7aa7c7;
  opacity: 1;
}

.bt-edge-3-9 {
  grid-column: 1 / 3;
  grid-row: 2;
  transform: rotate(-12deg);
}

.bt-edge-3-20 {
  grid-column: 3 / 5;
  grid-row: 2;
  transform: rotate(12deg);
}

.bt-edge-20-15 {
  grid-column: 3 / 4;
  grid-row: 4;
  transform: rotate(-15deg);
}

.bt-edge-20-7 {
  grid-column: 4 / 5;
  grid-row: 4;
  transform: rotate(15deg);
}

.bt-status-good {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.bt-status-warn {
  border-color: #b45309;
  background: #fff7ed;
  color: #7c2d12;
}

.bt-is-wrong {
  border-color: #b42318 !important;
  background: #fff1f0 !important;
  color: #7a271a !important;
}

.bt-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-btn {
  min-height: 46px;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  padding: 8px 10px;
  touch-action: manipulation;
}

.bt-btn-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.bt-token:focus-visible,
.bt-candidate:focus-visible,
.bt-socket:focus-visible,
.bt-btn:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .bt-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "table"
      "place"
      "tree";
  }

  .bt-tree-panel {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 520px) {
  .bt-topline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .bt-stat {
    padding: 8px;
  }

  .bt-stat strong {
    font-size: 15px;
    min-height: 20px;
  }

  .bt-table,
  .bt-placement,
  .bt-tree-panel {
    padding: 10px;
  }

  .bt-token,
  .bt-candidate {
    min-width: 44px;
    min-height: 44px;
    padding: 5px;
  }

  .bt-token span,
  .bt-candidate span {
    font-size: 18px;
  }

  .bt-socket {
    min-height: 68px;
  }

  .bt-tree-grid {
    grid-template-rows: 54px 24px 54px 24px 54px;
    gap: 0 6px;
    min-height: 210px;
    padding: 6px;
  }

  .bt-tree-node {
    min-height: 48px;
  }

  .bt-tree-node strong {
    font-size: 18px;
  }
}

@media (max-width: 380px) {
  .bt-topline {
    grid-template-columns: 1fr;
  }

  .bt-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .bt-section-head strong {
    text-align: left;
  }

  .bt-tree-grid {
    gap: 0 4px;
  }

  .bt-actions {
    grid-template-columns: 1fr;
  }
}
