.vector-game .board-word {
  cursor: pointer;
  position: absolute;
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
  animation: tileBreathe 2.8s ease-in-out infinite;
}

@keyframes tileBreathe {
  0%,
  100% {
    box-shadow:
      0 2px 5px rgba(50, 63, 98, 0.08),
      0 0 0 0 rgba(98, 99, 217, 0);
    border-color: #dce1e9;
  }
  50% {
    box-shadow:
      0 4px 14px rgba(98, 99, 217, 0.18),
      0 0 0 3px rgba(98, 99, 217, 0.12);
    border-color: #9293e5;
  }
}

.vector-game .board-word:hover,
.vector-game .board-word.selected {
  animation: none;
  transform: translateY(-2px) scale(1.03);
  background: #ffffff;
  border-color: #6263d9;
  color: #3b3d9c;
  box-shadow: 0 6px 18px rgba(98, 99, 217, 0.22);
  z-index: 10;
}

.vector-game .board-word:focus-visible {
  outline: 3px solid #6263d9;
  outline-offset: 3px;
  z-index: 11;
}

.vector-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  color: #596174;
  font-size: 13px;
}

.vector-instruction {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 6px 14px;
  border: 1px solid #e2e6f0;
  border-radius: 24px;
  font-size: 13px;
  color: #4a5468;
  box-shadow: 0 2px 6px rgba(50, 63, 98, 0.05);
}

.instruction-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6263d9;
  box-shadow: 0 0 0 0 rgba(98, 99, 217, 0.7);
  animation: dotPulse 2s infinite;
  flex-shrink: 0;
}

@keyframes dotPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(98, 99, 217, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 7px rgba(98, 99, 217, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(98, 99, 217, 0);
  }
}

.instruction-label {
  font-weight: 700;
  color: #4f51c7;
}

.instruction-text {
  color: #4a5468;
}

.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #45469c;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
}

.vector-game .grip {
  visibility: hidden;
}

.axes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.axis-line {
  stroke: #8991a2;
  stroke-width: 1.5;
}

.axis-label {
  fill: #596174;
  font:
    14px Vazir,
    sans-serif;
  direction: ltr;
}

.origin-dot {
  fill: #6263d9;
}

.hover-hint-callout {
  position: absolute;
  bottom: calc(100% + 11px);
  left: 50%;
  transform: translateX(-50%);
  background: #4f51c7;
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(79, 81, 199, 0.35);
  pointer-events: none;
  z-index: 20;
  animation: hintBounce 1.8s ease-in-out infinite;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.hint-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.9;
  animation: hintDotPulse 1.2s infinite alternate ease-in-out;
}

@keyframes hintDotPulse {
  0% {
    transform: scale(0.7);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.hint-arrow {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #4f51c7;
}

.hover-hint-callout.dismissed {
  opacity: 0;
  transform: translateX(-50%) translateY(4px) scale(0.85);
}

@keyframes hintBounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

.word-vector {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1.5px solid #6263d9;
  border-radius: 8px;
  background: #ffffff;
  color: #3b3d9c;
  font:
    13px Vazir,
    sans-serif;
  font-weight: 600;
  box-shadow:
    0 6px 16px rgba(98, 99, 217, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  white-space: nowrap;
  animation: vectorPopIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes vectorPopIn {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.word-vector.flip-left {
  left: auto;
  right: calc(100% + 10px);
  animation-name: vectorPopInLeft;
}

@keyframes vectorPopInLeft {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.word-vector.shift-down {
  top: 0;
  transform: none;
}

.word-vector.shift-up {
  top: auto;
  bottom: 0;
  transform: none;
}

.vector-column {
  position: relative;
  display: grid;
  gap: 4px;
  text-align: center;
  padding: 2px 9px;
}

.vector-column::before,
.vector-column::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.vector-column::before {
  left: 0;
  border-left: 1px solid currentColor;
}

.vector-column::after {
  right: 0;
  border-right: 1px solid currentColor;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #ffffffed;
  font-size: 14px;
  line-height: 2;
}

.empty-action-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  background: #6263d9;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(98, 99, 217, 0.25);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.empty-action-btn:hover {
  background: #5051c4;
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .vector-game .board-word,
  .hover-hint-callout,
  .instruction-dot,
  .hint-pulse-dot {
    animation: none !important;
  }
}

@media (max-width: 560px) {
  .vector-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .vector-game .board-viewport {
    height: calc(100dvh - 24px);
    min-height: 430px;
  }
}
