.nm { width: min(1080px, 100%); }
.nm-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.nm-body {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .8fr);
    gap: clamp(24px, 4.5vw, 72px);
    align-items: center;
}
.nm-puzzle { display: flex; justify-content: center; align-items: center; min-height: 0; }

.nm-num { font-family: var(--px-serif); font-size: clamp(30px, 3.2vw, 40px); line-height: 1; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }

.nm-slot {
    display: inline-grid;
    place-items: center;
    min-width: 1.9em;
    height: 1.5em;
    padding: 0 .3em;
    border-radius: .3em;
    font-family: var(--px-serif);
    font-size: clamp(30px, 3.2vw, 40px);
    line-height: 1;
    color: var(--px-accent);
    background: color-mix(in srgb, var(--px-accent) 8%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--px-accent) 55%, transparent), 0 0 26px -8px var(--px-accent);
    transition: color .25s, background .25s, box-shadow .25s;
}
.nm-slot-v { font-style: italic; }
.nm-slot.is-filled { color: var(--px-text); background: color-mix(in srgb, var(--px-accent) 16%, transparent); box-shadow: inset 0 0 0 1px var(--px-accent), 0 0 30px -6px var(--px-accent); }
.nm-slot.is-filled .nm-slot-v { font-style: normal; }

.nm-machine { display: grid; gap: clamp(10px, 1.8vh, 18px); width: min(620px, 100%); }
.nm-row {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.6fr) minmax(110px, 1fr);
    align-items: center;
    gap: 8px;
    min-height: clamp(54px, 8vh, 70px);
    opacity: 0;
    transform: translateX(-8px);
    animation: nm-row .6s var(--px-ease) forwards;
    animation-delay: calc(var(--i) * 110ms + 100ms);
}
@keyframes nm-row { to { opacity: 1; transform: none; } }
.nm-row + .nm-row { border-top: 1px solid var(--px-line); padding-top: clamp(10px, 1.8vh, 18px); }
.nm-row.is-query { border-top-color: var(--px-line-2); }
.nm-in { display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; }
.nm-and { font-family: var(--px-serif); font-style: italic; font-size: 17px; color: var(--px-text-3); }
.nm-out-wrap { display: flex; justify-content: flex-start; }
.nm-out { color: var(--px-text); }
.nm-row:not(.is-query) .nm-in .nm-num { color: var(--px-text-2); }
.nm-beam { width: 100%; height: 40px; overflow: visible; }
.nm-pulse { fill: #fff; opacity: 0; filter: drop-shadow(0 0 4px #fff); }
.nm-machine.is-run .nm-pulse { animation: nm-pulse 1.4s var(--px-ease) forwards; animation-delay: calc(var(--d, 0) * 1ms); }
.nm-machine.is-run .nm-row:nth-child(1) .nm-pulse { --d: 0; }
.nm-machine.is-run .nm-row:nth-child(2) .nm-pulse { --d: 160; }
.nm-machine.is-run .nm-row:nth-child(3) .nm-pulse { --d: 320; }
.nm-machine.is-run .nm-row:nth-child(4) .nm-pulse { --d: 480; }
.nm-machine.is-run .nm-row:nth-child(5) .nm-pulse { --d: 640; }
@keyframes nm-pulse {
    0% { opacity: 0; transform: translateX(0); }
    10% { opacity: 1; }
    48% { opacity: 1; fill: #fff; transform: translateX(110px); }
    52% { fill: var(--px-accent); }
    90% { opacity: 1; fill: var(--px-accent); }
    100% { opacity: 0; transform: translateX(220px); fill: var(--px-accent); }
}

.nm-ring { width: min(440px, 100%, max(280px, calc(100dvh - 330px))); height: auto; overflow: visible; }
.nm-orbit { fill: none; stroke: rgba(225, 232, 255, .06); stroke-width: 1; }
.nm-orbit.is-main { stroke: rgba(225, 232, 255, .13); }
.nm-orbit-glint { fill: none; stroke: var(--px-accent); stroke-width: 1.2; stroke-dasharray: .06 .94; stroke-dashoffset: 1; opacity: 0; transform-origin: 210px 210px; animation: nm-glint 3.2s var(--px-ease) .5s forwards; filter: drop-shadow(0 0 4px var(--px-accent)); }
@keyframes nm-glint { 0% { opacity: 0; stroke-dashoffset: 1; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: 0; } }
.nm-link { fill: none; stroke: rgba(225, 232, 255, .1); stroke-width: 1; stroke-dasharray: 3 4; }
.nm-bead { opacity: 0; animation: px-fade .7s var(--px-ease) forwards; animation-delay: calc(var(--i) * 70ms + 120ms); }
.nm-bead-c { stroke: rgba(225, 232, 255, .16); stroke-width: 1; }
.nm-bead-hl { fill: none; stroke: rgba(255, 255, 255, .26); stroke-width: 1.4; stroke-linecap: round; }
.nm-bead-t { fill: var(--px-text); font-family: var(--px-serif); font-size: 27px; font-variant-numeric: lining-nums; }
.nm-bead-q { fill: color-mix(in srgb, var(--px-accent) 9%, transparent); stroke: var(--px-accent); stroke-width: 1.2; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--px-accent) 70%, transparent)); }
.nm-bead-qi { fill: none; stroke: color-mix(in srgb, var(--px-accent) 35%, transparent); stroke-width: 1; stroke-dasharray: 2 4; animation: nm-spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nm-spin { to { transform: rotate(360deg); } }
.nm-qtext { fill: var(--px-accent); font-style: italic; }
.nm-bead.is-filled .nm-qtext { fill: var(--px-text); font-style: normal; }
.nm-core-c { fill: rgba(160, 180, 230, .05); }
.nm-core-r { fill: none; stroke: rgba(225, 232, 255, .3); stroke-width: 1; }
.nm-core-t { fill: var(--px-text); font-family: var(--px-serif); font-size: 34px; }

.nm-tower-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.nm-tower { --bw: clamp(64px, 7.4vw, 88px); --bh: clamp(48px, 6.2vh, 60px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nm-trow { display: flex; gap: 8px; }
.nm-brick {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--bw);
    height: var(--bh);
    border-radius: 7px;
    background: linear-gradient(180deg, #1D2741, #131B2E);
    box-shadow: inset 0 0 0 1px rgba(225, 232, 255, .1), inset 0 -3px 0 rgba(0, 0, 0, .35), 0 10px 20px -12px rgba(0, 0, 0, .8);
    opacity: 0;
    transform: translateY(-14px);
    animation: nm-drop .55s var(--px-ease) forwards;
    animation-delay: calc(var(--i) * 45ms);
}
@keyframes nm-drop { to { opacity: 1; transform: none; } }
.nm-brick-top { position: absolute; left: 6px; right: 6px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); }
.nm-brick-v { font-family: var(--px-serif); font-size: clamp(26px, 2.6vw, 32px); line-height: 1; }
.nm-brick.is-blank { background: repeating-linear-gradient(135deg, rgba(225, 232, 255, .025) 0 6px, transparent 6px 12px), rgba(160, 180, 230, .03); box-shadow: inset 0 0 0 1px rgba(225, 232, 255, .08); }
.nm-brick.is-q { background: color-mix(in srgb, var(--px-accent) 7%, #121A2C); box-shadow: inset 0 0 0 1px var(--px-accent), 0 0 30px -8px var(--px-accent); }
.nm-brick-slot { background: none; box-shadow: none; font-size: clamp(26px, 2.6vw, 32px); }
.nm-brick-slot.is-filled { background: none; box-shadow: none; }
.nm-rule { max-width: 360px; text-align: center; font-family: var(--px-serif); font-style: italic; font-size: 18px; color: var(--px-text-2); }

.nm-balance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; width: min(680px, 100%); }
.nm-balance:not(.is-many) { grid-template-columns: minmax(0, 340px); justify-content: center; }
.nm-balance.is-many .nm-scale.is-q:nth-child(odd):last-child { grid-column: 1 / -1; justify-self: center; width: calc(50% - 14px); }
.nm-scale { position: relative; opacity: 0; animation: px-fade .6s var(--px-ease) forwards; animation-delay: calc(var(--i) * 120ms + 100ms); }
.nm-scale-art { width: 100%; height: auto; overflow: visible; }
.nm-sc-post { stroke: rgba(225, 232, 255, .35); stroke-width: 2; }
.nm-sc-base { fill: rgba(225, 232, 255, .12); stroke: rgba(225, 232, 255, .25); stroke-width: 1; }
.nm-sc-beam { stroke: #D9DFEB; stroke-width: 3; stroke-linecap: round; }
.nm-sc-pivot { fill: #0A0D16; stroke: #D9DFEB; stroke-width: 2; }
.nm-sc-needle { fill: var(--px-accent); }
.nm-sc-chain { stroke: rgba(225, 232, 255, .22); stroke-width: 1; fill: none; }
.nm-sc-pan { fill: rgba(225, 232, 255, .08); stroke: rgba(225, 232, 255, .45); stroke-width: 1.2; }
.nm-scale.is-q .nm-sc-beam { stroke: var(--px-text); }
.nm-scale-pans { position: absolute; left: 0; right: 0; top: 0; height: 74.5%; pointer-events: none; }
.nm-pan-items {
    position: absolute;
    bottom: 0;
    width: 38%;
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
    transform: translateX(-50%);
}
.nm-pan-items:first-child { left: 14%; }
.nm-pan-items:last-child { left: 86%; }
.nm-shape { width: clamp(22px, 2.3vw, 30px); height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.nm-weight {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px 8px 6px 6px;
    background: linear-gradient(180deg, #F4F6FA, #C4CBD8);
    color: var(--px-ink);
    box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0, 0, 0, .18), 0 6px 10px -4px rgba(0, 0, 0, .6);
}
.nm-weight-ring { position: absolute; top: -7px; left: 50%; width: 14px; height: 9px; border: 2px solid #C4CBD8; border-bottom: 0; border-radius: 8px 8px 0 0; transform: translateX(-50%); }
.nm-weight-v { font-family: var(--px-serif); font-size: 22px; line-height: 1; }
.nm-weight.is-q { background: color-mix(in srgb, var(--px-accent) 12%, #10172A); box-shadow: inset 0 0 0 1px var(--px-accent), 0 0 22px -6px var(--px-accent); }
.nm-weight.is-q .nm-weight-ring { border-color: var(--px-accent); }
.nm-weight-slot { min-width: 0; height: auto; padding: 0; background: none; box-shadow: none; font-size: 22px; }
.nm-weight-slot.is-filled { background: none; box-shadow: none; }

.nm-panel { display: flex; flex-direction: column; align-items: stretch; gap: 16px; width: 100%; max-width: 340px; justify-self: end; }
.nm-read { display: flex; flex-direction: column; gap: 8px; }
.nm-read-k { font-family: var(--px-serif); font-style: italic; font-size: 17px; color: var(--px-text-2); }
.nm-read-win {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 84px;
    padding: 0 22px;
    border-radius: 18px;
    background: linear-gradient(180deg, #080B13, #0D1220);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(225, 232, 255, .1), 0 1px 0 rgba(255, 255, 255, .05);
    overflow: hidden;
}
.nm-read-win::after { content: ""; position: absolute; inset: 0 0 55%; background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent); pointer-events: none; }
.nm-read-v { font-family: var(--px-serif); font-size: 58px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; text-shadow: 0 0 22px color-mix(in srgb, var(--px-accent) 45%, transparent); }
.nm-read.is-tick .nm-read-v { animation: nm-tick .22s var(--px-ease); }
@keyframes nm-tick { from { transform: translateY(3px); opacity: .6; } }
.nm-caret { width: 2px; height: 46px; margin-left: 6px; border-radius: 1px; background: var(--px-accent); box-shadow: 0 0 8px var(--px-accent); animation: nm-blink 1.05s steps(2, start) infinite; }
@keyframes nm-blink { to { visibility: hidden; } }

.nm-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.nm-key {
    position: relative;
    height: 58px;
    padding: 0 0 5px;
    border: 0;
    border-radius: 14px;
    background: #070A12;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nm-key-face {
    position: absolute;
    inset: 0 0 5px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(180deg, #232D47, #19223A);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(225, 232, 255, .07);
    font-size: 22px;
    font-weight: 500;
    color: var(--px-text);
    transition: transform .09s ease-out, background .2s, box-shadow .2s;
}
.nm-key:hover .nm-key-face { background: linear-gradient(180deg, #2A3655, #1D2742); }
.nm-key.is-down .nm-key-face { transform: translateY(4px); background: linear-gradient(180deg, #1C2540, #151D33); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px color-mix(in srgb, var(--px-accent) 45%, transparent), 0 0 18px -6px var(--px-accent); }
.nm-key.is-del .nm-key-face, .nm-key.is-minus .nm-key-face { color: var(--px-text-2); background: linear-gradient(180deg, #1A2236, #141B2D); }
.nm-hint { font-size: 13px; color: var(--px-text-3); text-align: center; }

.nm-demo { position: absolute; inset: 0; display: grid; place-items: center; }
.nm-demo-machine .nm-machine { width: 92%; }
.nm-demo-machine .nm-row { grid-template-columns: 1fr 1.6fr 1fr; }
.nm-demo-ring .nm-ring { width: 62%; }
.nm-demo-tower .nm-tower { --bw: 64px; --bh: 46px; }
.nm-demo-balance .nm-balance { width: 70%; }

@media (max-width: 860px) {
    .nm-body { grid-template-columns: 1fr; gap: 18px; }
    .nm-panel { justify-self: center; max-width: 420px; gap: 10px; }
    .nm-read { flex-direction: row; align-items: center; gap: 12px; }
    .nm-read-k { flex: none; font-size: 15px; }
    .nm-read-win { flex: 1; height: 60px; border-radius: 14px; }
    .nm-read-v { font-size: 40px; }
    .nm-caret { height: 32px; }
    .nm-keys { gap: 7px; }
    .nm-key { height: 52px; }
    .nm-hint { display: none; }
    .nm-row { grid-template-columns: minmax(80px, 1fr) minmax(90px, 1.2fr) minmax(80px, 1fr); min-height: 48px; }
    .nm-num, .nm-slot { font-size: 28px; }
    .nm-ring { width: min(330px, 100%); }
    .nm-tower { --bw: clamp(54px, 18vw, 70px); --bh: 44px; gap: 6px; }
    .nm-trow { gap: 6px; }
    .nm-balance { gap: 10px 14px; }
    .nm-weight { min-width: 34px; height: 28px; padding: 0 5px; }
    .nm-weight-v, .nm-weight-slot { font-size: 18px; }
    .nm-shape { width: 18px; }
}
