/* Plotted — soft pastel quadrants on a lavender-white page */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --ink: #2a2737;
  --muted: #7a7590;
  --line: #e4e0ef;
  --accent: #7c6cf0;
  --accent-ink: #ffffff;
  --accent-soft: #ece9fe;
  --q1: #fde4e7; /* top-right: blush */
  --q2: #e2f0fd; /* top-left: sky */
  --q3: #e1f5ec; /* bottom-left: mint */
  --q4: #fdf3d6; /* bottom-right: butter */
  --axis: #cfc9e2;
  --pin-ring: #ffffff;
  --danger: #d0566b;
  --shadow: 0 1px 2px rgba(42, 39, 55, .06), 0 6px 20px rgba(42, 39, 55, .06);
  --display: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --body: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171f;
    --surface: #22212b;
    --ink: #edebf5;
    --muted: #9c97b3;
    --line: #34313f;
    --accent: #a497ff;
    --accent-ink: #18171f;
    --accent-soft: #2e2a47;
    --q1: #3a2a31;
    --q2: #24303f;
    --q3: #23362e;
    --q4: #3a3426;
    --axis: #4a4659;
    --pin-ring: #22212b;
    --danger: #f08497;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--body);
  min-height: 100vh;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* top bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 18px;
}
.wordmark {
  font: 600 20px/1 var(--display);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.wordmark .dot {
  width: 18px; height: 18px; border-radius: 6px;
  background: conic-gradient(var(--q2) 0 25%, var(--q1) 0 50%, var(--q4) 0 75%, var(--q3) 0);
  box-shadow: inset 0 0 0 1px var(--line);
  transform: rotate(-90deg);
}
.me { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.me img { width: 26px; height: 26px; border-radius: 50%; }
.me .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.me a { color: var(--muted); font-size: 13px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 10px 18px; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--accent-soft); color: var(--ink); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.discord { background: #5865f2; color: #fff; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }

.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn.danger { color: var(--danger); }

h1 {
  font: 600 clamp(26px, 6vw, 36px)/1.15 var(--display);
  margin: 0;
  text-wrap: balance;
}
.lede { color: var(--muted); margin: 8px 0 0; max-width: 52ch; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 8px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- chart ---------- */
.chart {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.chart .quad { position: absolute; width: 50%; height: 50%; }
.chart .quad.tl { left: 0; top: 0; background: var(--q2); }
.chart .quad.tr { right: 0; top: 0; background: var(--q1); }
.chart .quad.bl { left: 0; bottom: 0; background: var(--q3); }
.chart .quad.br { right: 0; bottom: 0; background: var(--q4); }
.chart .axis { position: absolute; background: var(--axis); }
.chart .axis.x { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; }
.chart .axis.y { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }
.chart.clickable { cursor: crosshair; }

.label {
  position: absolute; z-index: 1;
  font: 500 clamp(12px, 2.6vw, 15px)/1.2 var(--display);
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 5px 10px; border-radius: 999px;
  max-width: 34%;
  text-align: center;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.label.top { top: 10px; left: 50%; transform: translateX(-50%); max-width: 60%; }
.label.bottom { bottom: 10px; left: 50%; transform: translateX(-50%); max-width: 60%; }
.label.left { left: 10px; top: 50%; transform: translateY(-50%); text-align: left; }
.label.right { right: 10px; top: 50%; transform: translateY(-50%); text-align: right; }

.pin {
  position: absolute; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -18px);
  pointer-events: none;
  transition: left .25s ease, top .25s ease;
}
.pin.dragging { transition: none; z-index: 4; }
.pin img {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--pin-ring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  background: var(--line);
  pointer-events: auto;
}
.pin.mine { z-index: 3; }
.pin.mine img { border-color: var(--accent); cursor: grab; }
.pin.dragging img { cursor: grabbing; transform: scale(1.12); }
.pin .tag {
  margin-top: 2px;
  font-size: 11px; font-weight: 600; line-height: 1.2;
  background: var(--surface); color: var(--ink);
  padding: 2px 7px; border-radius: 999px;
  max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.pin.mine .tag { background: var(--accent); color: var(--accent-ink); }
.ghost-pin {
  position: absolute; z-index: 1; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2px dashed var(--accent); pointer-events: none; opacity: 0;
  transition: opacity .15s;
}
.chart.clickable:hover .ghost-pin { opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .pin, .btn, .toast { transition: none; }
}
