/* Natural selection lesson. All rules scoped under .ns-* */
.ns-sc { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ns-cap { font-size: 13px; color: var(--dim); text-align: center; }
.ns-note { font-size: 12px; color: var(--faint); text-align: center; }
.ns-hero { display: grid; place-items: center; }
.ns-hero img { width: 300px; max-width: 100%; max-height: 34vh; object-fit: contain; filter: drop-shadow(0 16px 28px rgba(123,92,253,.3)); }
.ns-bird img { width: 220px; }

/* the forest */
.ns-wrap { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.ns-hud { display: flex; align-items: center; gap: 10px; height: 18px; visibility: hidden; }
.ns-time { flex: 1; height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.ns-time i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--gold); }
.ns-time.on, .ns-count.on { visibility: visible; }
.ns-count { font: 700 13px var(--sans); color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; visibility: hidden; }
.ns-forest { position: relative; width: 100%; height: clamp(160px, 28vh, 250px); border-radius: 16px; overflow: hidden; background: #A9A698; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.ns-bark { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.ns-soot { opacity: 0; transition: opacity 0s linear; }
.ns-soot.on { opacity: 1; }
.ns-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.ns-moth {
  position: absolute; width: 48px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 50%;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(var(--k, 1));
  transition: left .6s cubic-bezier(.2,.8,.2,1), top .6s cubic-bezier(.2,.8,.2,1), transform .3s, opacity .3s, box-shadow .3s;
}
.ns-forest:not(.ns-hunting) .ns-moth { pointer-events: none; }
.ns-mo { width: 38px; height: 25px; display: block; overflow: visible; filter: drop-shadow(0 1px 1px rgba(0,0,0,.28)); }
.ns-sp { fill: #2B2926; opacity: .75; }
.ns-moth.ns-born { --k: .35; opacity: .2; transition: none; }
.ns-moth.ns-eaten { --k: 0; opacity: 0; }
.ns-moth.ns-new { box-shadow: 0 0 0 2px rgba(252,192,80,.9); }
.ns-moth.ns-ring { box-shadow: 0 0 0 2px var(--gold), 0 0 18px 4px rgba(252,192,80,.55); }
.ns-peck { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 3px solid var(--gold); animation: nsPeck .5s ease-out forwards; pointer-events: none; }
@keyframes nsPeck { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.ns-strip { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.ns-gen { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.ns-row { display: flex; gap: 2px; justify-content: center; padding: 4px 8px; border-radius: 10px; background: #8C897E; min-height: 22px; }
.ns-mini { width: 18px; height: 13px; display: block; }
.ns-mini .ns-sp { opacity: .6; }

/* the chain */
.ns-chain { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ns-chain .slot { min-height: 58px; }
.ns-chain .slot .n { font-size: 12px; }
.ns-chainend { font: 800 15px var(--sans); color: var(--faint); transition: color .4s; }
.ns-chainend.on { color: var(--gold); }
.ns-three { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ns-three > div { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.ns-three b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #2A1B00; font-weight: 800; font-size: 14px; }
.ns-three p { margin: 0; display: flex; flex-direction: column; gap: 1px; }
.ns-three span { font-weight: 800; font-size: 15px; line-height: 1.2; }
.ns-three small { font-size: 13px; color: var(--dim); line-height: 1.25; }
.ns-three em { display: flex; align-items: center; gap: 3px; padding: 6px 8px; border-radius: 10px; background: #8C897E; font-style: normal; }
.ns-three em i { font-style: normal; font-weight: 800; color: #2A1B00; font-size: 14px; }
.ns-ico { width: 26px; height: 17px; }

/* 98 in 100 */
.ns-big { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.ns-big b { font: 700 44px/1 var(--serif); color: var(--gold); }
.ns-big span { font-size: 13px; color: var(--dim); max-width: 260px; }
.ns-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 13px)); gap: 3px; }
.ns-grid i { width: 13px; height: 13px; border-radius: 4px; background: #2B2926; box-shadow: inset 0 0 0 1px rgba(234,227,215,.22); }
.ns-grid i.p { background: #D6D2C5; }

/* a moth on a patch of soot */
.ns-onsoot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px 20px 10px; border-radius: 16px;
  background: radial-gradient(circle at 20% 30%, #35312d 0 6px, transparent 7px), radial-gradient(circle at 70% 70%, #1a1917 0 9px, transparent 10px), radial-gradient(circle at 80% 20%, #302d2a 0 5px, transparent 6px), #252321; }
.ns-onsoot span { font-size: 13px; font-weight: 700; color: var(--text); }
.ns-lone { width: 96px; height: 63px; }
.ns-lone.ns-bigmoth { width: 120px; height: 79px; }
.ns-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; align-items: end; }
.ns-duo .ns-onsoot { height: 150px; justify-content: flex-end; }

/* marked moths, and results */
.ns-mark { display: flex; gap: 24px; justify-content: center; padding: 16px; border-radius: 16px; background: #6f6c63; }
.ns-mark > div { position: relative; }
.ns-tag { width: 130px; height: 85px; }
.ns-mark i { position: absolute; left: 50%; top: 58%; width: 9px; height: 9px; margin: -4.5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(252,192,80,.9); }
.ns-res { width: 100%; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.ns-rtitle { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); text-align: center; }
.ns-hbar { display: grid; grid-template-columns: 96px 1fr 50px; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.ns-hbar i { height: 14px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.ns-hbar b { display: block; height: 100%; width: 0; border-radius: 999px; background: #D6D2C5; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.ns-hbar.ns-dark b { background: #5a5650; box-shadow: inset 0 0 0 1px rgba(234,227,215,.4); }
.ns-hbar em { font: 600 14px var(--mono); font-style: normal; color: var(--text); text-align: right; opacity: 0; transition: opacity .4s .6s; }
.ns-res.on .ns-hbar em { opacity: 1; }

/* the dish */
.ns-dish { width: 100%; max-height: 36vh; display: block; overflow: visible; }
.ns-plate { fill: #182036; stroke: rgba(169,155,255,.55); stroke-width: 2.5; }
.ns-drug { fill: rgba(99,224,240,.16); stroke: #63E0F0; stroke-width: 2; opacity: 0; transition: opacity .3s; }
.ns-drug.on { opacity: 1; }
.ns-bug rect { fill: #9FC9A8; transition: fill .3s, opacity .4s; }
.ns-bug.res rect { fill: var(--gold); }
.ns-bug.dead rect { fill: #4a4f5c; opacity: .25; }
.ns-bug.ok rect { fill: #FFE2A0; }
.ns-key { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
.ns-key span { display: flex; align-items: center; gap: 8px; }
.ns-k { width: 14px; height: 7px; border-radius: 4px; background: #9FC9A8; flex: none; }
.ns-k.res { background: var(--gold); }
.ns-dishimg img { width: 280px; }

/* the giant dish */
.ns-mega { width: 100%; display: block; overflow: visible; }
.ns-mega .b0 { fill: #1a2136; } .ns-mega .b1 { fill: #2b2f5a; } .ns-mega .b2 { fill: #3d3b82; } .ns-mega .b3 { fill: #5446b0; } .ns-mega .b4 { fill: #6c55e0; }
.ns-front { fill: rgba(252,192,80,.3); }
.ns-edge { stroke: var(--gold); stroke-width: 3; }
.ns-mega text { font: 700 12px var(--sans); fill: var(--dim); text-anchor: middle; }
.ns-mega .ns-day { font: 800 20px var(--sans); fill: #fff; paint-order: stroke; stroke: rgba(10,14,26,.7); stroke-width: 4px; }

@media (max-height: 700px) {
  .ns-hero img { max-height: 30vh; }
  .ns-duo .ns-onsoot { height: 120px; }
  .ns-lone { width: 80px; height: 52px; } .ns-lone.ns-bigmoth { width: 100px; height: 66px; }
  .ns-dish { max-height: 30vh; }
  .ns-tag { width: 90px; height: 59px; }
}
