.rp-stage {
  position: relative;
  height: clamp(560px, 62vw, 700px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 55% 55%, rgba(255, 210, 31, 0.07), transparent 70%),
    linear-gradient(var(--bg-2), var(--bg));
  touch-action: pan-y;
}
.rp-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.rp-stage canvas:active { cursor: grabbing; }
.rp-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.rp-lines line { stroke: rgba(236, 232, 223, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.rp-lines circle { fill: var(--sc, #a7b0bd); stroke: var(--bg); stroke-width: 2; }
.rp-lines [data-s="holds"] { --sc: var(--holds); }
.rp-lines [data-s="untested"] { --sc: var(--untested); }
.rp-lines [data-s="cracked"] { --sc: var(--cracked); }
.rp-lines [data-s="fails"] { --sc: var(--fails); }

.rp-row {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  pointer-events: none;
}
.rp-row.top { top: 14px; right: calc(14px + 7%); }
.rp-row.bot { bottom: 54px; left: calc(14px + 7%); }
.rp-card {
  pointer-events: auto;
  text-align: left;
  background: rgba(22, 24, 28, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--sc);
  border-radius: 6px;
  padding: 9px 11px 10px;
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.rp-card:hover, .rp-card.on { background: rgba(32, 35, 41, 0.96); border-color: var(--sc); }
.rp-card.hit { box-shadow: 0 0 0 1px rgba(255, 79, 79, 0.6), 0 0 22px rgba(255, 79, 79, 0.18); }
.rp-card .h { display: flex; align-items: center; gap: 7px; }
.rp-card .h .mono { color: var(--hazard); font-size: 11px; }
.rp-card .h b { font-weight: 800; font-stretch: 110%; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-card .t {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 5px;
}

.rp-ctrl {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  background: rgba(12, 13, 15, 0.8);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 3px;
}
.rp-ctrl button { background: transparent; border: 0; color: var(--muted); font: 600 12px/1 var(--mono); padding: 7px 10px; border-radius: 3px; cursor: pointer; }
.rp-ctrl button.on { background: var(--hazard); color: var(--hazard-ink); }
.rp-hint { position: absolute; right: 16px; bottom: 20px; z-index: 3; color: var(--dim); font-size: 11px; }

.rp-chips { display: none; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rp-chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--sc);
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rp-chips button.on { border-color: var(--sc); background: var(--panel-2); }
.rp-chips .mono { color: var(--hazard); }

.rp-below { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.rp-below.nosheet { grid-template-columns: 1fr; }
.rp-sheet, .rp-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.sheet-title { display: flex; align-items: center; gap: 9px; font: 700 12px/1 var(--mono); letter-spacing: 0.1em; margin-bottom: 14px; }
.rp-sheet dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 9px 10px; margin: 0; font-size: 14px; }
.rp-sheet dt { font: 500 10.5px/1.9 var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.rp-sheet dd { margin: 0; overflow-wrap: anywhere; }
.rp-sheet .sc { font-weight: 900; font-stretch: 115%; font-size: 18px; color: var(--vc); margin-left: 4px; }
.rp-sheet a { color: var(--hazard); text-decoration: none; font-family: var(--mono); font-size: 13px; }

.impact {
  margin-top: 16px;
  border: 1px solid rgba(255, 79, 79, 0.45);
  background: linear-gradient(rgba(255, 79, 79, 0.08), rgba(255, 79, 79, 0.03));
  border-radius: 5px;
  padding: 12px 13px;
}
.impact b { font: 700 11px/1.3 var(--mono); letter-spacing: 0.08em; color: var(--fails); }
.impact p { margin: 6px 0 0; font-size: 14px; }

.rp-dhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rp-dhead h3 { margin: 0; font-weight: 900; font-stretch: 120%; text-transform: uppercase; font-size: 24px; line-height: 1; }
.rp-role { color: var(--dim); font: 500 12px/1.5 var(--mono); margin: 8px 0 0; }
.rp-hl { font-size: 18px; font-weight: 650; line-height: 1.35; margin: 14px 0 8px; }
.rp-body { color: var(--muted); margin: 0; font-size: 15px; }
.rp-detail h4 { font: 600 11px/1 var(--mono); letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; margin: 22px 0 10px; }
.rp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rp-cols ul { margin: 0; padding-left: 18px; font-size: 14px; }
.rp-cols li { margin: 4px 0; }
.rp-cols li::marker { color: var(--holds); }
.rp-cols ul.bad li::marker { color: var(--fails); }
.spec { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.spec th { text-align: left; font: 500 12px/1.4 var(--mono); color: var(--dim); padding: 6px 12px 6px 0; width: 34%; vertical-align: top; }
.spec td { padding: 6px 0; overflow-wrap: anywhere; }
.spec tr + tr { border-top: 1px dashed var(--line); }
.ev { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ev li { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-2); }
.ev .k { font: 700 10px/1 var(--mono); padding: 4px 0; text-align: center; border-radius: 3px; height: fit-content; color: var(--hazard-ink); background: var(--untested); }
.ev li[data-k="risk"] .k { background: var(--fails); }
.ev li[data-k="good"] .k { background: var(--holds); }
.ev b { font-weight: 650; font-size: 14px; }
.ev p { margin: 3px 0 4px; color: var(--muted); font-size: 13.5px; }
.ev a, .ev span:not(.k) { font: 500 12px/1.4 var(--mono); color: var(--hazard); overflow-wrap: anywhere; text-decoration: none; }
.ev span:not(.k) { color: var(--dim); }

@media (max-width: 980px) {
  .rp-below { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rp-stage { height: 360px; }
  .rp-row, .rp-lines, .rp-hint { display: none; }
  .rp-chips { display: flex; }
  .rp-cols { grid-template-columns: 1fr; }
}
