.nl-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.nl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.nl-statline,
.nl-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nl-stat,
.nl-hud-card {
  min-width: 74px;
  padding: 8px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.nl-stat span,
.nl-hud-card span {
  display: block;
  color: var(--cg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.nl-stat strong,
.nl-hud-card strong {
  display: block;
  margin-top: 2px;
  color: var(--cg-ink);
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.nl-btn,
.nl-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nl-btn {
  padding: 0 14px;
}

.nl-btn:hover,
.nl-close:hover {
  transform: translateY(-1px);
  border-color: var(--cg-teal);
}

.nl-btn:focus-visible,
.nl-close:focus-visible,
.nl-canvas:focus-visible,
.nl-seg-btn:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.35);
  outline-offset: 3px;
}

.nl-icon {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.nl-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nl-primary {
  border-color: transparent;
  background: var(--cg-teal);
  color: #fff;
}

.nl-hud {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.nl-hud-card {
  min-width: 0;
  text-align: center;
}

.nl-hud-card:first-child strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nl-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: #173942;
  box-shadow: var(--cg-shadow);
  touch-action: none;
}

.nl-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.68;
  min-height: 330px;
  max-height: min(68vh, 520px);
  cursor: crosshair;
}

.nl-start,
.nl-result,
.nl-flash {
  position: absolute;
  left: 50%;
  z-index: 4;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  color: var(--cg-ink);
  text-align: center;
  box-shadow: var(--cg-shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.nl-start {
  bottom: 18px;
  display: grid;
  gap: 6px;
  width: min(86%, 340px);
  padding: 16px;
  pointer-events: none;
}

.nl-start strong,
.nl-result strong {
  font-size: 22px;
  line-height: 1.1;
}

.nl-start span,
.nl-result span,
.nl-result p {
  margin: 0;
  color: var(--cg-muted);
  font-size: 14px;
}

.nl-flash {
  top: 22px;
  min-width: 130px;
  padding: 9px 14px;
  font-weight: 900;
  color: #fff;
  background: rgba(196, 122, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.38);
}

.nl-pop {
  animation: nl-pop 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nl-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.9); }
  22% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(0.98); }
}

.nl-result {
  top: 50%;
  display: grid;
  gap: 8px;
  width: min(88%, 340px);
  padding: 16px;
  transform: translate(-50%, -50%);
  animation: nl-result-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nl-result-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.nl-final-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.nl-final-cell {
  padding: 6px 2px;
  border: 1px solid var(--cg-line);
  border-radius: 7px;
  background: rgba(246, 247, 242, 0.92);
}

.nl-final-cell span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.nl-final-cell strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-result-actions {
  display: flex;
  gap: 8px;
}

.nl-result-actions .nl-btn {
  flex: 1 1 0;
}

.nl-below {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.nl-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.nl-seg-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.nl-seg-btn[aria-pressed="true"] {
  background: var(--cg-teal);
  color: #fff;
}

.nl-meter {
  flex: 1 1 180px;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--cg-line);
  border-radius: 999px;
  background: rgba(18, 122, 137, 0.12);
}

.nl-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cg-teal), var(--cg-amber));
  transition: width 160ms ease;
}

.nl-note {
  margin: 10px 0 0;
  color: var(--cg-muted);
  font-size: 13px;
  line-height: 1.45;
}

.nl-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 37, 40, 0.32);
}

.nl-modal-card {
  position: relative;
  width: min(100%, 430px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 70px rgba(30, 37, 40, 0.22);
}

.nl-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.nl-modal-card p {
  margin: 10px 0 0;
  color: var(--cg-muted);
  line-height: 1.45;
}

.nl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.nl-hide {
  display: none !important;
}

@media (max-width: 560px) {
  .nl-shell {
    padding: 0 10px 18px;
  }

  .nl-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nl-statline,
  .nl-actions {
    justify-content: center;
  }

  .nl-stat {
    flex: 1 1 72px;
    text-align: center;
  }

  .nl-hud {
    grid-template-columns: 1fr 1fr;
  }

  .nl-hud-card {
    padding: 7px 6px;
  }

  .nl-hud-card span {
    font-size: 9px;
  }

  .nl-hud-card strong {
    font-size: 16px;
  }

  .nl-canvas {
    aspect-ratio: 1 / 0.9;
    min-height: 350px;
  }

  .nl-seg {
    flex: 1 1 100%;
    justify-content: center;
  }

  .nl-seg-btn {
    flex: 1 1 0;
  }

  .nl-meter {
    flex-basis: 100%;
  }
}
