@import url('../tools/study.css');

:root[data-theme='dark'] {
  color-scheme: dark;
  --study-background: #121415;
  --study-ink: #e1e2de;
  --study-muted: #929995;
  --study-line: #303536;
  --study-accent: #e49b88;
  --control-count: 4;
}

.magnetic-loom {
  background: var(--study-background);
}
.magnetic-loom .study-identity h1 span {
  color: var(--study-accent);
}
.magnetic-loom .study-stage {
  overflow: hidden;
  isolation: isolate;
  background: #121415;
  touch-action: pan-y;
}
.magnetic-loom #canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.magnetic-loom .study-stats,
.magnetic-loom .study-readout {
  z-index: 2;
  pointer-events: none;
}
.magnetic-loom .study-notice {
  z-index: 5;
  pointer-events: none;
}
.magnetic-loom .loom-poles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.magnetic-loom .loom-pole {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #e99f8b;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
.magnetic-loom .loom-pole::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #121415;
}
.magnetic-loom .loom-pole svg {
  position: relative;
  width: 12px;
  height: 12px;
  stroke-width: 1.5;
}
.magnetic-loom .loom-pole[data-sign='-1'] {
  color: #86bcb5;
}
.magnetic-loom .loom-pole[aria-pressed='true']::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.38;
}
.magnetic-loom .loom-pole:hover::before {
  inset: 8px;
}
.magnetic-loom .loom-pole:focus-visible {
  outline: 1px solid var(--study-ink);
  outline-offset: 1px;
}
.magnetic-loom .loom-pole.is-dragging {
  cursor: grabbing;
}
.magnetic-loom .pole-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
}
.magnetic-loom .pole-tools .tool {
  width: 38px;
  height: 36px;
}
.magnetic-loom .positive {
  color: #e99f8b;
}
.magnetic-loom .negative {
  color: #86bcb5;
}
.magnetic-loom .segments span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 36px;
  padding: 6px;
}
.magnetic-loom .segments svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
}
.magnetic-loom .segments .positive input:checked + span {
  color: #e99f8b;
  border-color: #e99f8b;
}
.magnetic-loom .segments .negative input:checked + span {
  color: #86bcb5;
  border-color: #86bcb5;
}
.magnetic-loom .control legend {
  width: 100%;
}
.magnetic-loom .control legend output {
  float: right;
  font-variant-numeric: tabular-nums;
}
.magnetic-loom .tool:disabled {
  opacity: 0.25;
  cursor: default;
}
.magnetic-loom .loom-error {
  position: absolute;
  top: 40%;
  width: 100%;
  text-align: center;
  color: var(--study-muted);
}
.magnetic-loom .colophon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  min-height: 40px;
}
.magnetic-loom .colophon > span {
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.magnetic-loom .colophon > span:last-child {
  text-align: right;
}

@media (max-width: 600px) {
  .magnetic-loom .study-stats span:last-child {
    display: none;
  }
  .magnetic-loom .study-identity h1 {
    font-size: 32px;
  }
  .magnetic-loom .study-identity p {
    font-size: 12px;
  }
  .magnetic-loom .study-header {
    gap: 6px;
    flex-wrap: wrap;
  }
}
