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

.dia-prompt,
.dia-status,
.dia-best-path {
  min-width: 0;
  border: 1px solid #d3dbe7;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dia-status-good {
  border-color: #0f766e;
  background: #d7f4ef;
  color: #0f514b;
}

.dia-status-warn {
  border-color: #b45309;
  background: #fff7ed;
  color: #8a3b07;
}

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

.dia-stat {
  min-width: 0;
  border: 1px solid #d3dbe7;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  box-shadow: 0 8px 18px rgba(20, 31, 50, 0.05);
}

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

.dia-stat strong {
  display: block;
  min-height: 24px;
  margin-top: 3px;
  color: #17202a;
  font-size: 19px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.dia-station {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.72fr);
  gap: 12px;
  align-items: stretch;
}

.dia-tree,
.dia-console {
  min-width: 0;
  border: 1px solid #d3dbe7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(20, 31, 50, 0.06);
}

.dia-tree {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 250, 0.96)),
    repeating-linear-gradient(90deg, rgba(15, 118, 110, 0.045) 0, rgba(15, 118, 110, 0.045) 1px, transparent 1px, transparent 18px);
}

.dia-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dia-edge {
  fill: none;
  stroke: #b8c2d1;
  stroke-width: 1.8;
  stroke-linecap: round;
  transition: stroke 180ms ease, stroke-width 180ms ease;
}

.dia-edge-active {
  stroke: #2563eb;
  stroke-width: 3.3;
}

.dia-edge-best {
  stroke: #d97706;
  stroke-width: 3.8;
}

.dia-node {
  position: absolute;
  left: 0;
  top: 0;
  width: 52px;
  min-height: 52px;
  transform: translate(-50%, -50%);
  border: 2px solid #c6d0de;
  border-radius: 999px;
  background: #ffffff;
  color: #17202a;
  display: grid;
  place-items: center;
  padding: 4px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 8px 16px rgba(20, 31, 50, 0.09);
}

.dia-node:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.dia-node strong {
  font-size: 20px;
  line-height: 1;
}

.dia-height-badge {
  position: absolute;
  right: -8px;
  bottom: -7px;
  min-width: 25px;
  min-height: 22px;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
  display: grid;
  place-items: center;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(15, 118, 110, 0.22);
}

.dia-node-ready {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14), 0 8px 16px rgba(20, 31, 50, 0.09);
}

.dia-node-active {
  border-color: #d97706;
  background: #fff7ed;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18), 0 8px 16px rgba(20, 31, 50, 0.09);
}

.dia-node-done {
  border-color: #0f766e;
  background: #d7f4ef;
}

.dia-node-path {
  border-color: #d97706;
  background: #fef3c7;
}

.dia-node-wrong {
  border-color: #b42318;
  background: #fff1f0;
  animation: diaWrong 360ms ease;
}

.dia-console {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 12px;
}

.dia-console-head {
  border: 1px solid #d3dbe7;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.dia-console-head span {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.2;
}

.dia-console-head strong {
  display: block;
  margin-top: 4px;
  color: #17202a;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dia-measures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dia-line,
.dia-return,
.dia-btn {
  font: inherit;
}

.dia-line {
  min-width: 0;
  min-height: 72px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  padding: 9px;
  cursor: pointer;
  touch-action: manipulation;
}

.dia-line:active,
.dia-return:active,
.dia-btn:active {
  transform: scale(0.98);
}

.dia-line:disabled:not(.dia-line-pulled) {
  cursor: default;
  opacity: 0.68;
}

.dia-line-name {
  color: #475467;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.dia-line-track {
  position: relative;
  min-height: 10px;
  border-radius: 999px;
  background: #e5eaf1;
  overflow: hidden;
}

.dia-line-track::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--dia-fill, 12%);
  border-radius: inherit;
  background: #94a3b8;
}

.dia-line strong {
  color: #17202a;
  font-size: 22px;
  line-height: 1;
}

.dia-line-left.dia-line-pulled {
  border-color: #2563eb;
  background: #eff6ff;
}

.dia-line-right.dia-line-pulled {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.dia-line-left.dia-line-pulled .dia-line-track::after {
  background: #2563eb;
}

.dia-line-right.dia-line-pulled .dia-line-track::after {
  background: #7c3aed;
}

.dia-return {
  width: 100%;
  min-height: 48px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.dia-return:disabled {
  border-color: #d3dbe7;
  background: #eef2f6;
  color: #667085;
  cursor: default;
}

.dia-order {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  align-items: center;
}

.dia-order-node,
.dia-path-chip {
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 6px 10px;
  background: #eef2f6;
  color: #344054;
  font-weight: 900;
}

.dia-order-current {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 2px #2563eb;
}

.dia-order-done {
  background: #d7f4ef;
  color: #0f514b;
}

.dia-best-path {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 54px;
}

.dia-path-chip {
  background: #fef3c7;
  color: #92400e;
  box-shadow: inset 0 0 0 2px #d97706;
}

.dia-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.dia-btn {
  min-height: 44px;
  border: 1px solid #d3dbe7;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

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

@keyframes diaWrong {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(calc(-50% - 6px), -50%); }
  75% { transform: translate(calc(-50% + 6px), -50%); }
}

@media (max-width: 760px) {
  .dia-scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dia-stat {
    padding: 8px;
  }

  .dia-stat strong {
    font-size: 17px;
  }

  .dia-station {
    grid-template-columns: 1fr;
  }

  .dia-tree {
    min-height: 310px;
  }

  .dia-console {
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .dia-prompt,
  .dia-status,
  .dia-best-path {
    font-size: 14px;
    padding: 9px 10px;
  }

  .dia-scoreboard {
    gap: 6px;
  }

  .dia-stat span {
    font-size: 11px;
  }

  .dia-stat strong {
    font-size: 16px;
  }

  .dia-tree {
    min-height: 292px;
  }

  .dia-node {
    width: 48px;
    min-height: 48px;
  }

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

  .dia-measures {
    gap: 7px;
  }

  .dia-line {
    min-height: 68px;
    padding: 8px;
  }

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

  .dia-btn {
    width: 100%;
  }
}
