@font-face {
  font-family: Vazir;
  src: url('../fonts/vazir.ttf') format('truetype');
  font-display: swap;
}
:root {
  --paper: #f7f8fc;
  --ink: #293346;
  --muted: #758095;
  --border: #dce1e9;
  --accent: #6263d9;
  --selected: #eeeefb;
  font-family: Vazir, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
#board:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button {
  -webkit-tap-highlight-color: transparent;
}
.workspace {
  display: flex;
  min-height: 100dvh;
}
.sidebar {
  flex: 0 0 270px;
  padding: 32px 26px;
  border-left: 1px solid var(--border);
}
h1 {
  font-size: 21px;
  margin: 0 0 8px;
}
p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
}
.control {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  min-height: 44px;
}
.control:hover {
  border-color: var(--accent);
}
#reset {
  margin: 14px 0 26px;
}
.words {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.word {
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
.source {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  background: white;
}
.source.placed {
  opacity: 0.4;
}
.source.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.help {
  margin-top: 28px;
}
.line-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#board {
  position: relative;
  flex: 1;
  min-height: 480px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  direction: ltr;
  cursor: grab;
}
#board.target {
  cursor: crosshair;
}
.axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  height: 1px;
  background: var(--muted);
  pointer-events: none;
}
.axis-name {
  position: absolute;
  right: 4px;
  top: 12px;
  font:
    16px Georgia,
    serif;
  color: var(--muted);
}
#origin {
  position: absolute;
  top: 58%;
  height: 16px;
  width: 2px;
  transform: translate(-1px, -8px);
  background: var(--ink);
  pointer-events: none;
}
#origin span {
  position: absolute;
  top: 24px;
  left: 0;
  transform: translateX(-50%);
  font-size: 13px;
}
.pin {
  position: absolute;
  top: 58%;
  width: 0;
  height: 0;
  z-index: 2;
}
.pin-head {
  position: absolute;
  bottom: var(--stem);
  left: 0;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 8px 13px;
  min-height: 40px;
  direction: rtl;
  box-shadow: 0 2px 5px #29334608;
}
.pin-head::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  height: var(--stem);
  width: 1px;
  background: var(--muted);
  pointer-events: none;
}
.pin-head::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + var(--stem));
  transform: translate(-50%, -50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 7px solid var(--ink);
  pointer-events: none;
}
.pin.selected,
.pin:focus-within {
  z-index: 3;
}
.pin.selected .pin-head {
  border-color: var(--accent);
  background: var(--selected);
}
.pin.selected .pin-head::before {
  background: var(--accent);
}
.pin.selected .pin-head::after {
  border-top-color: var(--accent);
}
.pin.below .pin-head {
  bottom: auto;
  top: var(--stem);
}
.pin.below .pin-head::before {
  top: auto;
  bottom: 100%;
}
.pin.below .pin-head::after {
  top: auto;
  bottom: calc(100% + var(--stem));
  transform: translate(-50%, 50%);
  border-top: 0;
  border-bottom: 7px solid var(--ink);
}
.pin.below.selected .pin-head::after {
  border-bottom-color: var(--accent);
}
#preview {
  position: absolute;
  top: 58%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.axis-help {
  text-align: center;
  font-size: 11px;
}
.drag-ghost {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 700px) {
  .workspace {
    flex-direction: column;
  }
  .sidebar {
    flex-basis: auto;
    padding: 18px;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }
  h1 {
    font-size: 18px;
  }
  .sidebar > p {
    margin: 4px 0;
  }
  #reset {
    margin: 10px 0 16px;
  }
  .source {
    font-size: 12px;
    padding: 7px 10px;
  }
  .words {
    gap: 8px;
  }
  .sidebar .help {
    margin-top: 14px;
    font-size: 11px;
  }
  .line-section {
    padding: 16px 12px;
  }
  #board {
    min-height: 480px;
  }
  .pin-head {
    font-size: 12px;
  }
  .axis-help {
    margin-bottom: 0;
  }
}
