
/* ── Packet Run (network game) ──────────────────────────── */
.ng {
  max-width: 820px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 0.5rem 0.6rem;
  margin: 0.5rem 0 1rem;
  user-select: none;
}

.ng-tiers {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.35rem;
}

.ng-tier {
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.25rem 0.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.ng-tier.is-on {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.ng-tier[disabled] {
  opacity: 0.4;
  cursor: default;
}

.ng-ti {
  font-size: 1.1rem;
  line-height: 1;
}

.ng-tn {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ng-levels {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.4rem 0;
}

.ng-lvl {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 3.4rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.ng-lvl.is-on {
  border: 2px solid var(--accent);
}

.ng-lvl[disabled] {
  opacity: 0.45;
  cursor: default;
}

.ng-li {
  font-size: 1.05rem;
  line-height: 1.2;
}

.ng-ls,
.ng-wstars {
  color: #e8a33d;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.ng-ls i,
.ng-wstars i {
  font-style: normal;
  color: var(--border);
}

.ng-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 1rem;
  min-height: 2.2rem;
}

.ng-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.ng-g {
  font-family: var(--mono);
  font-weight: 650;
}

.ng-rules {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
}

.ng-rules code {
  font-size: 0.78rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}

.ng-stage {
  position: relative;
  margin-top: 0.4rem;
}

.ng-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(46vh, 410px);
  border-radius: 12px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--sunken, var(--surface-2));
  touch-action: manipulation;
}

.ng-svg text {
  font-family: var(--font);
}

.ng-zone {
  fill: color-mix(in srgb, var(--accent) 6%, transparent);
  stroke: color-mix(in srgb, var(--accent) 40%, transparent);
  stroke-dasharray: 6 5;
}

.ng-zl {
  font-size: 11px;
  fill: var(--muted);
  font-family: var(--mono) !important;
}

.ng-edge {
  stroke: color-mix(in srgb, var(--muted) 60%, transparent);
  stroke-width: 3;
  stroke-linecap: round;
}

.ng-edge.is-on {
  stroke: var(--accent);
  stroke-width: 5;
}

.ng-body {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 2;
  transition: stroke 0.15s, fill 0.15s;
}

.ng-node.is-click {
  cursor: pointer;
  outline: none;
}

.ng-node.is-click:hover .ng-body,
.ng-node.is-click:focus-visible .ng-body {
  stroke: var(--accent);
  stroke-width: 3;
}

.ng-node.is-start .ng-body {
  stroke: var(--good);
  stroke-width: 3;
}

.ng-node.is-goal .ng-body {
  stroke: #e8a33d;
  stroke-width: 3;
}

.ng-node.is-visited .ng-body {
  fill: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.ng-node.is-picked .ng-body {
  fill: color-mix(in srgb, var(--accent) 22%, var(--surface));
  stroke: var(--accent);
  stroke-width: 3;
}

.ng-node.st-dead .ng-body {
  fill: color-mix(in srgb, var(--bad) 16%, var(--surface));
  stroke: var(--bad);
}

.ng-node.st-dead .ng-ico {
  opacity: 0.45;
}

.ng-node.st-wait .ng-body {
  stroke: var(--warn);
  stroke-dasharray: 4 3;
}

.ng-node.st-ok .ng-body {
  stroke: var(--good);
}

.ng-ico {
  font-size: 26px;
}

.ng-ico.is-big {
  font-size: 34px;
}

.ng-badge {
  font-size: 14px;
}

.ng-lab {
  font-size: 12px;
  font-weight: 650;
  fill: var(--text);
}

.ng-sub {
  font-size: 11px;
  fill: var(--muted);
  font-family: var(--mono) !important;
}

.ng-cardt {
  font-size: 13px;
  font-weight: 650;
  fill: var(--text);
  font-family: var(--mono) !important;
}

.ng-reveal {
  font-size: 12px;
  font-weight: 700;
  fill: var(--good);
  font-family: var(--mono) !important;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
}

.ng-pk {
  font-size: 24px;
}

.ng-pk.is-small {
  font-size: 18px;
}

.ng-packet {
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.ng-link {
  stroke-width: 3;
  fill: none;
}

.ng-link.is-open {
  stroke: var(--good);
}

.ng-link.is-shut {
  stroke: var(--bad);
  stroke-dasharray: 5 5;
  opacity: 0.55;
}

.ng-ahp {
  fill: var(--muted);
}

.ng-chip {
  cursor: pointer;
  outline: none;
}

.ng-chip circle {
  fill: var(--surface);
  stroke: var(--good);
  stroke-width: 2;
}

.ng-chip.is-shut circle {
  stroke: var(--bad);
}

.ng-chip:focus-visible circle,
.ng-chip:hover circle {
  stroke-width: 3.5;
}

.ng-chip text {
  font-size: 13px;
}

.ng-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.ng-btn {
  font: inherit;
  font-size: 1.05rem;
  min-width: 2.3rem;
  height: 2.3rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.ng-btn:hover {
  border-color: var(--accent);
}

.ng-btn.ng-small {
  min-width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
}

.ng-check {
  min-width: 4rem;
  background: var(--color-accent-fill);
  border-color: var(--color-accent-fill);
  color: var(--color-accent-contrast);
  font-weight: 700;
}

.ng-miss {
  margin-right: auto;
  color: var(--bad);
  font-weight: 700;
  letter-spacing: 0.1em;
  min-width: 1rem;
}

.ng-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ng-hint {
  margin: 0.5rem 0 0;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  font-size: 0.9rem;
}

.ng-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.ng-win {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(2px);
  border-radius: 12px;
}

.ng-win[hidden] {
  display: none;
}

.ng-wcard {
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.ng-burst {
  font-size: 2.6rem;
}

.ng-wstars {
  font-size: 2rem;
}

.ng-wbtns {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ng-next {
  background: var(--color-accent-fill);
  border-color: var(--color-accent-fill);
  color: var(--color-accent-contrast);
  min-width: 4rem;
}

.ng-crown {
  font-size: 2rem;
}

.ng-shake {
  animation: ng-shake 0.4s;
}

@keyframes ng-shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.ng-node.ng-shake {
  animation: ng-shake-node 0.4s;
}

@keyframes ng-shake-node {
  20%, 60% { translate: -5px 0; }
  40%, 80% { translate: 5px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ng-shake,
  .ng-node.ng-shake {
    animation: none;
  }
}

@media (max-width: 900px) {
  .ng-tiers {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 560px) {
  .ng-tn {
    display: none;
  }

  /* the board is scaled down on phones: draw text bigger inside it */
  .ng-lab { font-size: 19px; }
  .ng-sub { font-size: 17px; }
  .ng-cardt { font-size: 17px; }
  .ng-reveal { font-size: 17px; }
  .ng-ico { font-size: 30px; }

  .ng-goal {
    font-size: 0.95rem;
  }
}

.ng-lvl.is-skipped .ng-ls {
  color: var(--muted);
}

/* Chapter heading for the game page: one compact line so the board starts high */
.ng-title {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin: 0.2rem 0 0.4rem;
}

.ng-title span {
  font-size: 0.7em;
  margin-left: 0.4rem;
  white-space: nowrap;
}
