* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f2f4f8; }

.nm-outer { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.nm-container { width: 100%; max-width: 780px; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 18px 45px rgba(0,0,0,0.15); }

.nm-header {
  background: #1c4e9e; color: #fff; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.nm-instruction { font-size: 13px; font-weight: 600; }
.nm-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nm-progress, .nm-score, .nm-life { font-size: 13px; font-weight: 700; }
.nm-home-btn { background: #2ecc71; color: #fff; border: none; border-radius: 20px; padding: 6px 16px; font-size: 12px; font-weight: 700; cursor: pointer; }

.nm-scene { background: linear-gradient(#bfe3fb 0%, #bfe3fb 55%, #8fd68a 55%, #6fc562 100%); min-height: 460px; padding: 20px; }

.nm-loading, .nm-warning { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; gap: 14px; color: #3a3a3a; }
.nm-spinner { width: 36px; height: 36px; border: 4px solid #cfe8ff; border-top-color: #1c4e9e; border-radius: 50%; animation: nm-spin 0.8s linear infinite; }
@keyframes nm-spin { to { transform: rotate(360deg); } }
.nm-warning-icon { font-size: 40px; }

.nm-play-area { display: flex; gap: 16px; align-items: flex-start; }
.nm-labels { flex: 1; display: flex; flex-direction: column; gap: 12px; }

.nm-label-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff8ec; border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}
.nm-label-text { flex: 1; font-size: 16px; font-weight: 700; color: #4a3200; text-transform: capitalize; }
.nm-blank {
  width: 56px; height: 44px;
  background: #eef1fb; border: 2px dashed #4a6fa5; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #1c4e9e;
  cursor: default;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.nm-blank.filled { border-style: solid; border-color: #2ecc71; background: #fff; cursor: pointer; }
.nm-blank.correct { border-color: #2ecc71; background: #d7f9e4; }
.nm-blank.incorrect { border-color: #e74c3c; background: #fdecea; animation: nm-shake 0.4s; }
@keyframes nm-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.nm-tree-wrap { position: relative; width: 110px; text-align: center; flex-shrink: 0; }
.nm-tree { font-size: 90px; line-height: 1; }
.nm-mango { position: absolute; top: -6px; right: 6px; font-size: 26px; }
.nm-monkey { font-size: 40px; position: relative; top: -14px; transition: transform 0.4s; }
.nm-monkey.climb-1 { transform: translateY(-14px); }
.nm-monkey.climb-2 { transform: translateY(-28px); }
.nm-monkey.slip { transform: translateY(10px); }

.nm-feedback { text-align: center; font-size: 14px; font-weight: 700; padding: 8px 16px; margin-top: 14px; border-radius: 10px; }
.nm-feedback-correct { background: #e6f9ee; color: #1e8449; }
.nm-feedback-incorrect { background: #fdecea; color: #c0392b; }

.nm-tiles-label { text-align: center; font-size: 12px; font-weight: 700; color: #4a3200; margin: 18px 0 6px; }
.nm-tiles { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.nm-tile {
  width: 56px; height: 48px;
  background: #ff9f1c; border: 3px solid #d97e0a; border-radius: 10px;
  color: #fff; font-size: 18px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.nm-tile:hover { transform: translateY(-3px); }
.nm-tile.selected { background: #5b8def; border-color: #3f6fd8; }

.nm-submit-wrap { display: flex; justify-content: center; margin-top: 22px; }
.nm-submit-btn {
  background: #2ecc71; color: #fff; border: none; border-radius: 14px;
  padding: 12px 40px; font-size: 16px; font-weight: 800; cursor: pointer;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2); transition: opacity 0.15s;
}
.nm-submit-btn:disabled { opacity: 0.5; cursor: default; }

.nm-result { text-align: center; padding: 50px 30px; background: #fff; }
.nm-result-icon { font-size: 56px; margin-bottom: 8px; }
.nm-result h2 { margin: 0 0 8px; color: #2f3542; }
.nm-result p { color: #6b6b6b; margin: 0 0 20px; }
.nm-result-stats { display: flex; justify-content: center; gap: 30px; margin-bottom: 26px; }
.nm-result-stats span { display: block; font-size: 26px; font-weight: 800; color: #ff9f1c; }
.nm-result-stats small { color: #999; font-size: 12px; }
.nm-result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.nm-btn { border: none; border-radius: 12px; padding: 12px 26px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.nm-btn-primary { background: #2ecc71; color: #fff; }
.nm-btn-secondary { background: #5b8def; color: #fff; }

.nm-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.nm-modal { background: #fff; border-radius: 16px; padding: 26px 24px; max-width: 340px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.nm-modal p { font-size: 15px; font-weight: 600; color: #2f3542; margin: 0 0 18px; }
.nm-modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 640px) {
  .nm-instruction { flex-basis: 100%; text-align: center; order: 1; font-size: 11px; }
  .nm-header-right { order: 2; margin: 0 auto; }
  .nm-play-area { flex-direction: column; align-items: center; }
  .nm-tree-wrap { width: 100%; }
  .nm-tree { font-size: 60px; }
  .nm-mango { font-size: 20px; }
  .nm-labels { width: 100%; }
  .nm-btn { width: 100%; justify-content: center; }
}
