#zones, #labels, #weights { position: fixed; inset: 0; pointer-events: none; }
#weights { z-index: 5; }

/* ---- weights: 10 navy, 5 yellow, 1 grey ---- */
.w {
  --wc: #2b3a5e;
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px 11px 9px 9px;
  background: var(--wc); color: #fff;
  font-weight: 700; line-height: 1;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 3px 8px rgba(31, 42, 68, 0.18);
  pointer-events: auto; touch-action: none; cursor: grab;
  will-change: transform;
}
.w::before {
  content: ""; position: absolute; left: 50%; top: -11px; transform: translateX(-50%);
  width: 42%; height: 15px; box-sizing: border-box;
  border: 5px solid var(--wc); border-bottom: none; border-radius: 12px 12px 0 0;
}
.w50 { --wc: #7b52d9; width: 88px; height: 70px; font-size: 31px; }
.w10 { width: 72px; height: 58px; font-size: 27px; }
.w5 { --wc: #f2b200; width: 58px; height: 46px; font-size: 23px; color: #3d2e00; }
.w1 { --wc: #aab4c8; width: 44px; height: 34px; font-size: 18px; color: #1f2a44; }
.w1::before { border-width: 4px; top: -9px; height: 12px; }
.w.lift { cursor: grabbing; z-index: 10; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 16px 28px rgba(31, 42, 68, 0.3); }
.w.gone { transition: opacity 0.25s, filter 0.25s; opacity: 0; filter: blur(3px); pointer-events: none; }

/* ---- the source weights at the bottom ---- */
.palette {
  display: flex; align-items: flex-end; gap: 22px; pointer-events: auto;
  padding: 24px 28px 14px; border-radius: 24px;
  background: var(--card); box-shadow: 0 4px 14px rgba(31, 42, 68, 0.1);
}
.w.src { position: relative; }
.w.src:active { transform: scale(0.94); }
/* three columns so the weights are always in the middle */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; }
.bar .group:first-child { justify-self: start; }
.bar .group:last-child { justify-self: end; }

/* ---- drop areas, shown while dragging ---- */
.zone {
  position: absolute; left: 0; top: 0;
  border: 3px dashed rgba(79, 107, 237, 0.35); border-radius: 18px;
  background: rgba(79, 107, 237, 0.04);
  opacity: 0; transition: opacity 0.2s, background 0.15s, border-color 0.15s;
}
body.dragging .zone { opacity: 1; }
.zone.active { background: rgba(79, 107, 237, 0.16); border-color: var(--accent); }

/* ---- what each section weighs ---- */
.slabel {
  position: absolute; left: 0; top: 0; transform: translateX(-50%); white-space: nowrap;
  min-width: 46px; padding: 6px 12px 5px; border-radius: 999px; text-align: center;
  font-size: 22px; font-weight: 700; line-height: 1;
  background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(31, 42, 68, 0.1);
  transition: color 0.2s;
}
.slabel.zero { color: #c3c9d4; }
.slabel.pop { animation: lpop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }

/* ---- the comparison sign ---- */
.eq .sign {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.2em; height: 1.2em; border-radius: 50%;
  background: var(--accent); color: #fff; margin: 0 0.12em;
}
.eq .sign.same { background: var(--plus); }
.eq .sign svg { width: 62%; height: 62%; display: block; }
.eq .sign path { fill: none; stroke: #fff; stroke-width: 4.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eq .num.zero { color: #c3c9d4; }
.eq .op { color: var(--muted); }

@keyframes lpop { 0% { transform: translateX(-50%) scale(0.6); } 100% { transform: translateX(-50%) scale(1); } }

/* narrow screens (iPad portrait): "start over" becomes an icon so the weights stay centred */
@media (max-width: 900px) {
  #clear { width: 56px; padding: 0; }
  #clear span { display: none; }
  #clear::before { content: "⟲"; font-size: 28px; }
}
@media (max-width: 600px) {
  .palette { gap: 14px; padding: 20px 14px 12px; }
  #clear { width: 48px; }
}
