/* ── Block container ─────────────────────────────── */
/* Width is a % of the parent container. Both max-width and max-height
   are capped at 85vh so the diagram can never run off-screen vertically
   on desktop. On mobile (≤768px), it fills the container width. The
   85vh ceiling is intentionally explicit and redundant: max-width + the
   1:1 aspect-ratio caps height geometrically, max-height is the
   belt-and-suspenders. container-type: inline-size makes 1cqw = 1% of
   block width, so inner geometry scales proportionally at any size. */
.rpg-block {
    position: relative;
    width: var(--rpg-width-pct, 75%);
    max-width: 85vh;
    max-height: 85vh;
    aspect-ratio: 1 / 1;
    margin: 2rem auto;
    border-style: none;
    container-type: inline-size;
}

@media (max-width: 768px) {
    .rpg-block {
        width: 100%;
    }
}

.rpg-block *,
.rpg-editor-host * {
    box-sizing: border-box;
}

/* ── SVG lines ───────────────────────────────────── */
.rpg-lines {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

/* ── Center & Node shared ────────────────────────── */
.rpg-center,
.rpg-node {
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 999px;
}

/* ── Center ──────────────────────────────────────── */
.rpg-center {
    width: var(--rpg-center-size);
    height: var(--rpg-center-size);
    transform: translate(-50%, -50%);
    background-color: var(--rpg-center-bg);
    border: 2px solid var(--rpg-border-color);
    z-index: 3;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out;
}

.rpg-center:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.rpg-center-inner {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    color: var(--rpg-text-color);
    font-weight: 600;
    font-size: clamp(13px, 4.4cqw, 26px);
    line-height: 1.2;
    text-wrap: balance;
}

.rpg-center-label { color: inherit; }

/* ── Nodes ───────────────────────────────────────── */
.rpg-node {
    width: var(--rpg-node-size);
    height: var(--rpg-node-size);
    margin-left: calc(var(--rpg-node-size) / -2);
    margin-top: calc(var(--rpg-node-size) / -2);
    background-color: var(--rpg-node-bg);
    border: 2px solid var(--rpg-border-color);
    z-index: 2;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform:
        rotate(var(--rpg-angle))
        translateY(calc(var(--rpg-radius) * -1))
        rotate(calc(var(--rpg-angle) * -1));
    transition: transform 0.2s ease-in-out;
}

.rpg-node:hover {
    transform:
        rotate(var(--rpg-angle))
        translateY(calc(var(--rpg-radius) * -1))
        rotate(calc(var(--rpg-angle) * -1))
        scale(1.05);
}

.rpg-node-inner {
    width: 100%; height: 100%;
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.65rem;
}

.rpg-node-label {
    color: var(--rpg-text-color);
    font-size: clamp(10px, 2.2cqw, 14px);
    font-weight: 500;
    line-height: 1.2;
    text-wrap: balance;
}

/* ── Empty state ─────────────────────────────────── */
.rpg-empty {
    padding: 1.5rem;
    border: 1px dashed #c0c8d0;
    background: #f7f9fb;
    border-radius: 4px;
    color: #6b7280;
    font-size: 14px;
}

/* ── Editor host ─────────────────────────────────── */
.rpg-editor-host {
    padding: 16px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 8px;
}

/* ── Upgrade notice ──────────────────────────────── */
.rpg-upgrade-notice {
    margin: 0;
    padding: 14px 16px;
    background: #f0f6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 4px 4px 0;
}

.rpg-upgrade-heading {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: 0.03em;
}

.rpg-upgrade-body {
    margin: 0 0 12px;
    font-size: 12px;
    color: #374151;
    line-height: 1.5;
}

.rpg-upgrade-button.components-button.is-primary {
    width: 100%;
    justify-content: center;
    background: #2563eb;
    border-color: #2563eb;
}

.rpg-upgrade-button.components-button.is-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.rpg-pro-hint {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.5;
}

.rpg-upgrade-link {
    color: #2563eb;
    font-weight: 500;
    text-decoration: none;
}

.rpg-upgrade-link:hover {
    text-decoration: underline;
}
