#pact-edges{overflow:visible;}

  .osrs-pact-root {
    position: relative;
    margin: 2rem 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --node-size-sm: 120px;
    --node-size-md: 170px;
    --node-size-lg: 220px;

    --edge-width: 8px;
  }

  .osrs-pact-root .global-error,
  .osrs-pact-root .global-success {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.6rem 1.5rem;
    text-shadow: 0 0 4px #000;
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;

    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.9);

    transform: translateY(100%);
    transition: transform 0.5s ease;
    pointer-events: none;
  }
  .osrs-pact-root .global-error { color: #fc2121; z-index: 10100; }
  .osrs-pact-root .global-success { color: #b6ffcf; z-index: 10101; }
  .osrs-pact-root .global-error.visible,
  .osrs-pact-root .global-success.visible { transform: translateY(0); }

  .osrs-pact-root .pact-viewport {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 600px;
    margin: 0 auto;
    overflow: hidden;
    cursor: grab;

    background: url("https://cdn.runescape.com/assets/img/external/oldschool/leagues/YamaBackground.png");
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85);
  }
  .osrs-pact-root .pact-viewport.grabbing { cursor: grabbing; }

  .osrs-pact-root .pact-viewport.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    border-radius: 0;
    border: none;
    z-index: 10010;
    background: url("https://cdn.runescape.com/assets/img/external/oldschool/leagues/YamaBackground.png");
  }

  .osrs-pact-root .pact-controls {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 7;
    display: flex;
    gap: 0.25rem;
    align-items: center;
  }
  .osrs-pact-root .pact-controls button {
    background: rgba(20, 8, 4, 0.9);
    border: 1px solid rgba(255, 187, 132, 0.6);
    color: #ffd9b0;
    font-size: 0.9rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
    user-select: none;
  }
  .osrs-pact-root .pact-controls button:hover {
    background: rgba(40, 16, 8, 0.95);
  }

  .osrs-pact-root .pact-fullscreen-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 8;
    background: rgba(10, 3, 2, 0.9);
    border: 1px solid rgba(255, 187, 132, 0.65);
    color: #ffd9b0;
    font-size: 0.95rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  }
  .osrs-pact-root .pact-viewport.is-fullscreen .pact-fullscreen-close { display: flex; }

  .osrs-pact-root .pact-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.12s ease-out;
  }
  .osrs-pact-root .pact-edges {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }
  .osrs-pact-root .pact-nodes {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }

  .osrs-pact-root .pact-node {
    position: absolute;
    --node-size: var(--node-size-md);
    width: var(--node-size);
    height: var(--node-size);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;

    cursor: pointer;
    opacity: 0;

    pointer-events: none;
  }
  .osrs-pact-root .pact-node.size-sm { --node-size: var(--node-size-sm); }
  .osrs-pact-root .pact-node.size-md { --node-size: var(--node-size-md); }
  .osrs-pact-root .pact-node.size-lg { --node-size: var(--node-size-lg); }

  .osrs-pact-root .pact-node.is-root {
    opacity: 1;
    pointer-events: auto;
  }

  .osrs-pact-root .pact-node.unlocked {
    pointer-events: auto;
  }

  @keyframes dissolveIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) translateY(18px) scale(0.9); filter: blur(4px); }
    30%  { opacity: 0.35; transform: translate(-50%, -50%) translateY(10px) scale(0.94); filter: blur(2.5px); }
    70%  { opacity: 0.9; transform: translate(-50%, -50%) translateY(2px) scale(1.02); filter: blur(0.6px); }
    100% { opacity: 1; transform: translate(-50%, -50%) translateY(0) scale(1); filter: none; }
  }
  .osrs-pact-root .pact-node.visible {
    animation: dissolveIn 1.6s ease-out forwards;
  }

  .osrs-pact-root .pact-edge {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: var(--edge-width);
    fill: none;
    opacity: 0;

    --dash: 0;
    stroke-dasharray: var(--dash);
    stroke-dashoffset: var(--dash);

    transition:
      stroke-dashoffset 3.4s ease-out,
      opacity 0.25s ease-out,
      stroke 0.35s ease-out;
  }
  .osrs-pact-root .pact-edge.active {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  .osrs-pact-root .pact-edge.is-solved {
    stroke: #ff2a2a;
  }

  .osrs-pact-root .node-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 10030;
  }
  .osrs-pact-root .node-modal.active { display: flex; }

  .osrs-pact-root .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
  }
  .osrs-pact-root .modal-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
  }
  .osrs-pact-root .contract-shell {
    position: relative;
    pointer-events: auto;
  }

  @keyframes scrollDropIn {
    0%   { opacity: 0; transform: translateY(-40vh) scale(0.95); filter: blur(6px); }
    35%  { opacity: 0.6; transform: translateY(-8vh) scale(1.01); filter: blur(2px); }
    70%  { opacity: 1; transform: translateY(-2vh) scale(1); filter: blur(0.5px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: none; }
  }
  .osrs-pact-root .contract-shell.drop-in { animation: scrollDropIn 0.9s ease-out forwards; }

  @keyframes dissolveOut {
    0%   { opacity: 1; transform: translateY(0) scale(1); filter: none; }
    35%  { opacity: 0.95; transform: translateY(-3px) scale(1.01); filter: blur(0.5px); }
    70%  { opacity: 0.5; transform: translateY(-10px) scale(0.97); filter: blur(2px); }
    100% { opacity: 0; transform: translateY(-18px) scale(0.94); filter: blur(4px); }
  }
  .osrs-pact-root .contract-shell.dissolving {
    animation: dissolveOut 2.2s ease-out forwards;
    transform-origin: center bottom;
  }

  .osrs-pact-root .contract-scroll {
    display: block;
    width: min(100vw, 1200px);
    height: auto;
    max-height: 95vh;
  }
  .osrs-pact-root .contract-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8% 20% 10% 20%;
    text-align: center;
  }
  .osrs-pact-root .contract-text-box {
    width: 100%;
    height: 60%;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 3rem;
    padding-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 42, 22, 0.65) rgba(255, 255, 255, 0.12);
  }
  .osrs-pact-root .contract-text-box.is-scrollable {
    align-items: flex-start;
  }
  .osrs-pact-root .contract-text-box::-webkit-scrollbar {
    width: 10px;
  }
  .osrs-pact-root .contract-text-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
  }
  .osrs-pact-root .contract-text-box::-webkit-scrollbar-thumb {
    background: rgba(59, 42, 22, 0.65);
    border-radius: 999px;
  }
  .osrs-pact-root .contract-text {
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    width: 100%;
    max-width: 100%;
    color: #000000;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .osrs-pact-root .contract-text > *:first-child { margin-top: 0; }
  .osrs-pact-root .contract-text > *:last-child { margin-bottom: 0; }
  .osrs-pact-root .contract-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    width: 80%;
  }
  .osrs-pact-root .contract-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid #2a1b11;
    background: transparent;
    outline: none;
    font-size: 1.05rem;
    padding: 0.5rem 0;
    color: #2a1b11;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .osrs-pact-root .contract-button {
    border: none;
    background: #a30a0a;
    color: #fbe7d9;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  }
  .osrs-pact-root .contract-button:hover { background: #e45823; }

  .pact-edge, svg path {
  stroke-linecap: round;
  stroke-linejoin: round;
  }


.osrs-pact-root .ember-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.osrs-pact-root .ember {
  position: absolute;
  bottom: -20px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffae00 0%, #ff2a00 60%, transparent 70%);
  opacity: 0.8;
  animation: rise linear forwards;
}

@keyframes rise {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.9;
  }
  100% {
    transform: translateY(-700px) scale(0.4);
    opacity: 0;
  }
}