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

.fd-question {
  min-height: 48px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
  color: #1f2937;
  font-size: 16px;
  font-weight: 750;
}

.fd-board {
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f7fb 100%);
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: hidden;
}

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

.fd-metric {
  min-width: 0;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  display: grid;
  gap: 2px;
}

.fd-metric span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.fd-metric strong {
  color: #17202a;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.fd-arena {
  position: relative;
  width: 100%;
  min-height: 340px;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 24px 24px;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
}

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

.fd-edge {
  fill: none;
  stroke: #a7b0be;
  stroke-width: 2.8;
  stroke-linecap: round;
  opacity: 0.62;
}

.fd-edge-cycle {
  stroke: #2563eb;
  opacity: 0.5;
}

.fd-edge-merge {
  stroke: #d97706;
}

.fd-edge-active {
  stroke: #0f766e;
  stroke-width: 4.2;
  opacity: 1;
  filter: drop-shadow(0 3px 5px rgba(15, 118, 110, 0.2));
  animation: fd-wire 720ms ease;
}

.fd-arrow {
  fill: #6b7280;
}

.fd-arrow-active {
  fill: #0f766e;
}

.fd-node {
  position: absolute;
  z-index: 2;
  width: 76px;
  min-height: 70px;
  transform: translate(-50%, -50%);
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 7px 6px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 8px 18px rgba(20, 31, 50, 0.08);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

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

.fd-node-k,
.fd-node-v {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.fd-node strong {
  color: #111827;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.fd-node-entry {
  background: #ecfeff;
  border-color: #0891b2;
}

.fd-node-source {
  background: #fff7ed;
  border-color: #d97706;
}

.fd-node-done {
  background: #d7f4ef;
  border-color: #0f766e;
  animation: fd-pop 480ms ease;
}

.fd-node-wrong {
  background: #fff1f0;
  border-color: #b42318;
  animation: fd-shake 340ms ease;
}

.fd-pointer {
  position: absolute;
  z-index: 4;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transform: translate(calc(-50% + var(--fd-dx)), calc(-50% + var(--fd-dy)));
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  border: 2px solid #ffffff;
  box-shadow: 0 9px 18px rgba(20, 31, 50, 0.22);
  pointer-events: none;
  animation: fd-drop 260ms ease;
}

.fd-pointer-slow {
  background: #2563eb;
}

.fd-pointer-fast {
  background: #b42318;
}

.fd-rail {
  min-height: 46px;
  border: 1px dashed #a7b0be;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.fd-chip {
  min-height: 30px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
}

.fd-chip-on {
  background: #d7f4ef;
  color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.32);
}

.fd-status {
  min-height: 58px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
  color: #344054;
  font-size: 15px;
}

.fd-status-good {
  border-color: #0f766e;
  background: #d7f4ef;
  color: #134e4a;
}

.fd-status-warn {
  border-color: #d97706;
  background: #fff7ed;
  color: #7c2d12;
}

.fd-actions {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) minmax(150px, 1fr);
  gap: 10px;
  align-items: center;
}

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

.fd-btn:active {
  transform: scale(0.98);
}

.fd-btn:disabled {
  cursor: default;
  color: #667085;
  background: #eef2f6;
}

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

.fd-btn-primary:disabled {
  border-color: #cbd5e1;
  color: #667085;
  background: #eef2f6;
}

@keyframes fd-wire {
  0% { stroke-dasharray: 1 18; }
  100% { stroke-dasharray: 90 0; }
}

@keyframes fd-drop {
  from {
    opacity: 0;
    transform: translate(calc(-50% + var(--fd-dx)), calc(-74% + var(--fd-dy))) scale(0.84);
  }
  to {
    opacity: 1;
    transform: translate(calc(-50% + var(--fd-dx)), calc(-50% + var(--fd-dy))) scale(1);
  }
}

@keyframes fd-pop {
  0% { transform: translate(-50%, -50%) scale(0.92); }
  55% { transform: translate(-50%, -50%) scale(1.08); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

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

@media (max-width: 760px) {
  .fd-board {
    padding: 10px;
    gap: 10px;
  }

  .fd-metrics {
    gap: 6px;
  }

  .fd-metric {
    padding: 8px 7px;
  }

  .fd-metric strong {
    font-size: 18px;
  }

  .fd-arena {
    min-height: 315px;
    background-size: 20px 20px;
  }

  .fd-node {
    width: 64px;
    min-height: 62px;
    padding: 6px 4px;
  }

  .fd-node strong {
    font-size: 21px;
  }

  .fd-node-k,
  .fd-node-v {
    font-size: 10px;
  }

  .fd-pointer {
    width: 30px;
    height: 30px;
  }

  .fd-question,
  .fd-status {
    font-size: 14px;
  }
}

@media (max-width: 390px) {
  .fd-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .fd-metric:first-child {
    grid-column: 1 / -1;
  }

  .fd-arena {
    min-height: 300px;
  }

  .fd-node {
    width: 60px;
    min-height: 58px;
  }

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