/* Rift map modal (public/rift-map.js) — port of the "Rift map analysis modal"
   design handoff. Everything is `.rm-` prefixed; tokens come from review.css.
   Pins are round on purpose (the design's champion portraits), everything
   else keeps the squared instrument style. No reticle corners. */

.rm-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; font-family: var(--font-sans); }
.rm-root[hidden] { display: none; }
.rm-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(2px); }
.rm-modal {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  width: min(96vw, max(min(400px, 96vw), calc(min(880px, 95vh) - 52px)));
  height: min(880px, 95vh);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-modal); overflow: hidden;
}
/* Fullscreen (theater) host: the overlay lives inside the fullscreen element. */
.theater > .rm-root { position: absolute; }

.rm-head { flex: none; display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--border); overflow: hidden; }
.rm-head svg.rm-ico { flex: none; stroke: var(--accent); }
.rm-head h3 { margin: 0; font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }
.rm-snap { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-snap b { color: var(--text); font-weight: 600; }
.rm-zoom {
  flex: none; height: 30px; padding: 0 9px; background: var(--surface-raised); border: 1px solid var(--border);
  color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap;
}
.rm-zoom.on { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.rm-nav { flex: none; display: flex; gap: 4px; }
.rm-nav .rm-arrow {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--text); font-family: var(--font-mono); font-size: 12px; cursor: pointer;
}
.rm-nav .rm-arrow:hover { border-color: var(--accent-border); color: var(--accent); }
.rm-nav .rm-cur {
  flex: 0 0 72px; width: 72px; height: 30px; box-sizing: border-box; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); border: 1px solid var(--brand);
  color: #fff; font-family: var(--font-mono); font-size: 11px; white-space: nowrap; cursor: pointer;
}
.rm-nav .rm-cur:hover { background: var(--brand-hover); }
.rm-nav .rm-cur:not(.on), .rm-nav .rm-cur:not(.on):hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.rm-vsep { width: 1px; height: 22px; background: var(--border); flex: none; }
.rm-x {
  width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: transparent;
  border: 1px solid transparent; color: var(--text-muted); font-family: var(--font-mono); font-size: 14px; cursor: pointer; padding: 0;
}
.rm-x:hover { color: var(--text); border-color: var(--border); }

.rm-body { flex: 1; min-height: 0; display: flex; gap: 6px; padding: 6px; }
.rm-tools { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--surface-raised); border: 1px solid var(--border); padding: 5px; }
.rm-tool, .rm-inkbtn, .rm-undo, .rm-clear {
  width: 34px; height: 32px; padding: 0; flex: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
}
.rm-tool.on { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.rm-tools .rm-hsep { flex: none; height: 1px; width: 100%; background: var(--border); margin: 3px 0; }
.rm-tools .rm-grow { flex: 1; min-height: 8px; }
.rm-inkwrap { flex: none; position: relative; }
.rm-inkbtn { border-color: var(--border); }
.rm-inkbtn.on { background: var(--accent-soft); border-color: var(--accent-border); }
.rm-inkbtn .chip { width: 16px; height: 16px; outline: 1px solid var(--border); }
.rm-inkpop {
  position: absolute; left: 42px; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 24px); gap: 4px; padding: 5px;
  background: var(--surface-raised); border: 1px solid var(--accent-border); box-shadow: var(--shadow-modal);
}
.rm-inkpop[hidden] { display: none; }
.rm-inkpop button { width: 24px; height: 24px; flex: none; cursor: pointer; padding: 0; border: 2px solid transparent; outline: 1px solid var(--border); }
.rm-inkpop button.on { border-color: var(--text); }
.rm-undo:hover, .rm-clear:hover { color: var(--text); border-color: var(--border); }
.rm-clear:hover { color: var(--red); }
.rm-undo.off { color: var(--text-faint); cursor: default; }
.rm-undo.off:hover { color: var(--text-faint); border-color: transparent; }

.rm-stagewrap { flex: 1; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
.rm-stage {
  position: relative; height: 100%; width: auto; flex: none; aspect-ratio: 1; max-width: 100%;
  background: #05060a; border: 1px solid var(--border); overflow: hidden; cursor: crosshair; touch-action: none; user-select: none;
}
.rm-stage.tool-move { cursor: grab; }
.rm-stage.tool-move.grabbing { cursor: grabbing; }
.rm-stage.tool-pen, .rm-stage.tool-eraser { cursor: none; }
/* The map is painted onto a device-resolution canvas (base + the visible
   tiles of the zoom's level) rather than CSS-transformed <img>s — a
   transformed layer is rasterized once and scaled by the compositor, which
   is blurry at any zoom above 1×. */
.rm-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; filter: brightness(.8) saturate(.92); }
.rm-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.rm-svg .rm-ext { pointer-events: auto; }
.rm-pin {
  position: absolute; padding: 0; transform: translate(-50%, -50%); overflow: hidden; touch-action: none; border-radius: 50%;
  background: #05060a center/cover no-repeat; border: 2px solid var(--rm-team); box-shadow: 0 1px 5px rgba(0, 0, 0, .65); cursor: default; pointer-events: none;
}
.rm-grid-pin { will-change: transform; }
/* review.css's global button:hover would paint the border dark; keep the
   team colour and just lift it a touch with a soft halo. */
.rm-pin:hover { background-color: #05060a; border-color: color-mix(in srgb, var(--rm-team) 72%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rm-team) 35%, transparent), 0 1px 5px rgba(0, 0, 0, .65); }
.rm-pin.sel, .rm-pin.sel:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rm-pin.live { pointer-events: auto; }
.rm-pin.fallback { display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: #fff; }
.rm-ring { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; }
.rm-ring.pen { box-shadow: 0 0 0 1px rgba(5, 6, 10, .8); }
.rm-ring.eraser { background: rgba(231, 233, 242, .06); border: 1px dashed rgba(231, 233, 242, .85); }
.rm-labels { position: absolute; inset: 0; pointer-events: none; }
.rm-label {
  position: absolute; display: flex; flex-direction: column; gap: 1px; padding: 3px 7px; transform: translate(-50%, -124%);
  background: rgba(12, 13, 19, .92); border: 1px solid var(--rm-col, var(--cyan)); color: #e7e9f2;
  font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.35;
}
.rm-label.bare {
  padding: 0; background: none; border: none; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; transform: translate(-50%, -160%);
  text-shadow: 0 0 3px #05060a, 0 1px 2px #05060a, -1px 0 1px #05060a, 1px 0 1px #05060a, 0 -1px 1px #05060a;
}
.rm-label.mid { transform: translate(-50%, -50%); }

.rm-menu {
  position: absolute; z-index: 8; width: 196px; background: var(--surface); border: 1px solid var(--accent-border);
  box-shadow: var(--shadow-modal); padding: 8px 9px 9px;
}
.rm-menu[hidden] { display: none; }
.rm-menu .row { display: flex; align-items: center; gap: 8px; }
.rm-menu .swatch { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid var(--rm-team); background: #05060a center/cover no-repeat; }
.rm-menu .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-menu .who b { font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-menu .who span { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.rm-menu .mx {
  flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; background: transparent;
  border: 1px solid transparent; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; cursor: pointer; padding: 0;
}
.rm-menu .mx:hover { color: var(--text); border-color: var(--border); }
.rm-menu .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.rm-menu label { display: flex; flex-direction: column; gap: 3px; font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); }
.rm-menu input {
  width: 100%; height: 26px; background: var(--surface-raised); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 7px; outline: none; caret-color: var(--accent);
}
.rm-menu .eff { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; }
.rm-menu .eff span { flex: 1; font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.rm-menu .eff b { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.rm-menu .eff button { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); background: transparent; border: none; cursor: pointer; padding: 0; }
.rm-menu .eff button:hover { color: var(--text); }
.rm-menu .parts { margin-top: 6px; font-family: var(--font-mono); font-size: 9px; line-height: 1.45; color: var(--text-faint); }
.rm-menu .parts b { color: var(--text-muted); font-weight: 500; }

.rm-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; height: 54px; padding: 0 12px; border-top: 1px solid var(--border); }
.rm-hint { flex: 1; min-width: 0; margin: 0; display: block; font-family: var(--font-mono); font-size: 11px; line-height: 1.4; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-hint b { color: var(--accent); font-weight: 400; }
.rm-resetpos { flex: none; height: 34px; padding: 0 12px; background: var(--surface-raised); border: 1px solid var(--border); color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; cursor: pointer; }
.rm-resetpos:hover { border-color: var(--accent-border); color: var(--text); }
.rm-save {
  flex: none; height: 34px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; background: var(--brand); border: 1px solid var(--brand);
  color: #fff; font-family: var(--font-sans); font-size: 13px; font-weight: 600; cursor: pointer;
}
.rm-save:hover { background: var(--brand-hover); }
.rm-save[hidden] { display: none; }
.rm-save.busy { opacity: .7; pointer-events: none; }

.rm-toast {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  background: var(--surface-raised); border: 1px solid var(--accent-border); box-shadow: var(--shadow-modal);
  font-family: var(--font-mono); font-size: 11px; color: var(--text); animation: rm-toast .18s ease-out; z-index: 9;
}
.rm-toast[hidden] { display: none; }
.rm-toast i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
@keyframes rm-toast { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* review.css squares every element (`body * { border-radius: 0 !important }`);
   the design's champion portraits, cursor ring and menu swatch are round. */
body .rm-pin, body .rm-ring, body .rm-menu .swatch, body .rm-toast i { border-radius: 50% !important; }

/* Toolbar entry on the review page. */
/* Icon + keybind buttons on the transport (Draw, Map): no word, the glyph
   carries the meaning and the rebindable key sits beside it. */
.vc-btn.vc-icon-kb { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; flex: none; white-space: nowrap; }
.vc-btn.vc-icon-kb svg { flex: none; display: block; }
.vc-btn.vc-icon-kb [data-kb] { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.vc-btn.vc-icon-kb [data-kb]:empty { display: none; }
#riftMapBtn.tool-active { border-color: var(--accent-border); color: var(--accent); }
