/* NavMesh Studio — scoped to the NavMesh panel. */
#navmesh {
  --nm-violet: #a993ef;
  --nm-cyan: #79bef7;
  --nm-red: #ff667e;
  --nm-red-soft: rgba(255, 83, 112, .14);
  --nm-panel: rgba(18, 16, 24, .84);
  --nm-panel-strong: rgba(23, 20, 30, .96);
}

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

.nm-heading,
.nm-market-heading,
.nm-section-heading,
.nm-editor-topbar,
.nm-tool-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nm-heading { margin-bottom: 22px; }
.nm-heading h2,
.nm-section h3,
.nm-market-heading h3 { margin: 0; color: #fbf8fa; }
.nm-heading h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.04em; }
.nm-heading .lede { max-width: 820px; margin: 9px 0 0; }

.nm-security-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(112, 213, 170, .2);
  border-radius: 999px;
  background: var(--green-soft);
  color: #a4e6ca;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.nm-security-pill svg { width: 17px; height: 17px; }

.nm-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 34px;
}

.nm-summary-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}
.nm-summary-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: var(--lavender-soft);
  color: #cfc3f9;
}
.nm-summary-icon.public { background: var(--blue-soft); color: #b9ddfb; }
.nm-summary-icon.blocked { background: var(--red-soft); color: #ff9aac; }
.nm-summary-icon svg { width: 20px; height: 20px; }
.nm-summary-card div { min-width: 0; }
.nm-summary-card strong { display: block; color: #fff; font-size: 24px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.nm-summary-card small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.nm-section { margin-top: 34px; }
.nm-section-heading { margin-bottom: 13px; }
.nm-section-heading .eyebrow,
.nm-market-heading .eyebrow { margin-bottom: 4px; }
.nm-section h3,
.nm-market-heading h3 { font-size: 20px; letter-spacing: -.025em; }

.nm-icon-button,
.nm-small-actions button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: #c9c1c8;
}
.nm-icon-button:hover,
.nm-small-actions button:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(255,255,255,.075); color: #fff; }
.nm-icon-button svg,
.nm-small-actions svg { width: 18px; height: 18px; }

.nm-mine-grid,
.nm-market-grid { display: grid; gap: 13px; }
.nm-mine-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.nm-market-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.nm-empty-card {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 24px;
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.018);
  color: #918891;
  font-size: 12px;
  text-align: center;
}

.nm-mine-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(32,28,39,.82), rgba(18,16,23,.76));
  box-shadow: var(--shadow);
  transition: transform .22s var(--ease), border-color .22s ease, box-shadow .22s var(--ease);
}
.nm-mine-card:hover { transform: translateY(-2px); border-color: rgba(169,147,239,.25); box-shadow: var(--shadow-raised); }
.nm-mine-preview {
  position: relative;
  width: 74px;
  height: 74px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: #09080d;
}
.nm-mine-preview canvas { display: block; width: 100%; height: 100%; }
.nm-mine-copy { min-width: 0; }
.nm-mine-copy h4 { margin: 0 0 5px; overflow: hidden; color: #fff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.nm-mine-copy p { margin: 0; color: var(--muted); font-size: 11px; }
.nm-mine-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.nm-mine-stats span { color: #aaa0aa; font-size: 10px; }
.nm-mine-stats .blocked { color: #ff91a4; }
.nm-edit-button {
  min-width: 88px;
  padding: 0 15px;
  border: 1px solid rgba(169,147,239,.24);
  border-radius: 12px;
  background: var(--lavender-soft);
  color: #ded6ff;
  font-weight: 730;
}
.nm-edit-button:hover { border-color: rgba(169,147,239,.42); background: rgba(169,147,239,.2); box-shadow: 0 10px 26px rgba(91,71,155,.16); }

.nm-market-heading { align-items: flex-end; margin-bottom: 13px; }
.nm-market-heading p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.nm-search { position: relative; width: min(330px, 100%); margin: 0; }
.nm-search svg { position: absolute; z-index: 1; left: 14px; top: 50%; width: 18px; height: 18px; color: #817781; transform: translateY(-50%); pointer-events: none; }
.nm-search input { width: 100%; padding-left: 42px; border-radius: 13px; }

.nm-filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.nm-filter {
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: #918891;
  font-size: 11px;
  font-weight: 700;
}
.nm-filter:hover { color: #ddd5db; background: rgba(255,255,255,.055); }
.nm-filter.active { border-color: rgba(240,165,198,.25); background: rgba(220,118,165,.12); color: #ffd6e7; }

.nm-market-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(29,25,35,.92), rgba(13,12,18,.93));
  box-shadow: var(--shadow);
  transition: transform .24s var(--ease), border-color .22s ease, box-shadow .24s var(--ease);
}
.nm-market-card:hover { transform: translateY(-3px); border-color: rgba(240,165,198,.2); box-shadow: var(--shadow-raised); }
.nm-market-preview { position: relative; height: 180px; overflow: hidden; background: radial-gradient(circle at 50% 48%, rgba(169,147,239,.1), transparent 62%), #07070b; }
.nm-market-preview::after { content: ""; position: absolute; inset: auto 0 0; height: 55%; background: linear-gradient(transparent, rgba(10,9,14,.76)); pointer-events: none; }
.nm-market-preview canvas { display: block; width: 100%; height: 100%; }
.nm-map-badge { position: absolute; z-index: 2; top: 12px; min-height: 28px; display: flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; backdrop-filter: blur(12px); font-size: 10px; font-weight: 760; }
.nm-map-badge { left: 12px; background: rgba(12,11,16,.72); color: #eee8ed; }
.nm-map-badge svg { width: 14px; height: 14px; color: var(--pink); }
.nm-market-body { padding: 15px; }
.nm-market-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.nm-market-title h4 { margin: 0; color: #fff; font-size: 14px; line-height: 1.3; }
.nm-source-kind { flex: 0 0 auto; color: #bdb1e5; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nm-market-author { display: flex; align-items: center; gap: 7px; margin: 9px 0; color: #aaa1aa; font-size: 11px; }
.nm-author-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(145deg, #e17fab, #8958ca); color: #fff; font-size: 9px; font-weight: 800; }
.nm-market-description { min-height: 34px; margin: 0 0 14px; color: #948b94; font-size: 11px; line-height: 1.55; }
.nm-market-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.nm-market-meta { color: #786f78; font-size: 10px; }
.nm-use-button { min-width: 120px; padding: 0 14px; border: 1px solid rgba(112,213,170,.23); border-radius: 11px; background: var(--green-soft); color: #b4eed7; font-size: 11px; font-weight: 760; }
.nm-use-button:hover { border-color: rgba(112,213,170,.4); background: rgba(112,213,170,.2); box-shadow: 0 10px 24px rgba(36,126,89,.13); }

.nm-status { min-height: 20px; margin: 14px 0 0; color: #b7abc9; font-size: 11px; }
.nm-status.error { color: #ff9aac; }

/* Editor */
.nm-editor[hidden],
.nm-library[hidden] { display: none !important; }
.nm-editor { margin-inline: -18px; }
.nm-editor-topbar {
  min-height: 64px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(19,17,24,.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 13px 30px rgba(0,0,0,.16);
  backdrop-filter: blur(18px);
}
.nm-back { display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: #aaa1aa; font-weight: 690; }
.nm-back:hover { background: rgba(255,255,255,.055); color: #fff; }
.nm-back svg { width: 18px; height: 18px; }
.nm-editor-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nm-map-chip { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid rgba(169,147,239,.22); border-radius: 12px; background: var(--lavender-soft); color: #ded5ff; font-size: 10px; font-weight: 820; letter-spacing: .05em; }
.nm-editor-title p { margin: 0 0 2px; color: #fff; font-size: 14px; font-weight: 750; }
.nm-editor-title small { display: block; max-width: 320px; overflow: hidden; color: #8c838b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.nm-editor-save { display: flex; align-items: center; gap: 11px; }
.nm-save-state { color: #817881; font-size: 10px; white-space: nowrap; }
.nm-save-state.dirty { color: #efbb70; }
.nm-save-state.saving { color: #b8acf0; }
.nm-save-button { display: flex; align-items: center; gap: 7px; min-width: 148px; justify-content: center; padding: 0 15px; border: 1px solid rgba(240,165,198,.22); border-radius: 12px; background: linear-gradient(135deg, rgba(225,127,171,.88), rgba(184,78,129,.88)); color: #fff; font-size: 11px; font-weight: 760; box-shadow: 0 10px 25px rgba(181,68,123,.17), inset 0 1px 0 rgba(255,255,255,.18); }
.nm-save-button svg { width: 17px; height: 17px; }

.nm-editor-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 680px;
  height: calc(100vh - 185px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #09080d;
  box-shadow: 0 28px 70px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.035);
}
.nm-tools {
  position: relative;
  top: auto;
  z-index: 3;
  display: block;
  width: auto;
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24,21,29,.96), rgba(15,13,19,.96));
  box-shadow: 12px 0 32px rgba(0,0,0,.13);
  backdrop-filter: none;
}
.nm-tool-section { padding: 14px 10px; border-bottom: 1px solid rgba(255,255,255,.065); }
.nm-tool-section:last-child { border-bottom: 0; }
.nm-tool-label { margin: 0 0 10px; color: #9d949d; font-size: 9px; font-weight: 820; letter-spacing: .13em; text-transform: uppercase; }
.nm-tool-help { margin: 9px 1px 0; color: #746c74; font-size: 10px; line-height: 1.45; }
.nm-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.075); border-radius: 13px; background: rgba(0,0,0,.18); }
.nm-segmented button { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #817881; font-size: 10px; font-weight: 730; }
.nm-segmented button svg { width: 15px; height: 15px; }
.nm-segmented button:hover { color: #d6cfd5; }
.nm-segmented button.active { border-color: rgba(169,147,239,.18); background: var(--lavender-soft); color: #dcd3ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.045); }
.nm-segmented #nmBlockMode.active { border-color: rgba(255,102,126,.19); background: var(--nm-red-soft); color: #ff9aac; }
.nm-view-switch #nm3DView.active { border-color: rgba(126,200,255,.25); background: rgba(94,163,222,.14); color: #b9e4ff; }
.nm-camera-presets { display: none; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin-top: 7px; }
.nm-editor.is-3d .nm-camera-presets { display: grid; }
.nm-camera-presets button { min-width: 0; min-height: 44px; padding: 6px 3px; border: 1px solid rgba(255,255,255,.075); border-radius: 9px; background: rgba(255,255,255,.025); color: #8e858e; font-size: 9px; font-weight: 740; }
.nm-camera-presets button:hover { border-color: rgba(126,200,255,.2); background: rgba(126,200,255,.07); color: #caeaff; }
.nm-camera-presets button.active { border-color: rgba(126,200,255,.3); background: rgba(94,163,222,.15); color: #c7eaff; }
.nm-height-control { display: none; min-height: 54px; margin-top: 7px; padding: 8px 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(255,255,255,.02); color: #8e858e; font-size: 9px; font-weight: 690; }
.nm-editor.is-3d .nm-height-control { display: grid; gap: 6px; }
.nm-height-control span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nm-height-control output { color: #bfe6ff; font-variant-numeric: tabular-nums; }
.nm-height-control input { width: 100%; height: 18px; margin: 0; padding: 0; accent-color: #8fcfff; cursor: pointer; }

.nm-toggle-list { display: grid; gap: 5px; }
.nm-toggle-list label { display: flex; align-items: center; gap: 9px; min-height: 44px; margin: 0; padding: 6px 8px; border-radius: 10px; color: #a9a0a8; font-size: 11px; cursor: pointer; }
.nm-toggle-list label:hover { background: rgba(255,255,255,.035); color: #e5dfe4; }
.nm-toggle-list input { appearance: none; position: relative; width: 34px; height: 20px; min-height: 20px; flex: 0 0 34px; margin: 0; padding: 0; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: rgba(255,255,255,.06); cursor: pointer; }
.nm-toggle-list input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8c848b; transition: transform .25s var(--ease), background .2s ease; }
.nm-toggle-list input:checked { border-color: rgba(169,147,239,.4); background: rgba(169,147,239,.27); }
.nm-toggle-list input:checked::after { transform: translateX(14px); background: #eee9ff; }
.nm-toggle-list .nm-blocked-toggle:has(input:checked) { color: #ff9aac; background: rgba(255,102,126,.055); }
.nm-toggle-list .nm-blocked-toggle input:checked { border-color: rgba(255,102,126,.45); background: rgba(255,102,126,.3); }
.nm-toggle-list .nm-blocked-toggle i { width: 8px; height: 8px; margin-left: auto; border-radius: 3px; background: var(--nm-red); box-shadow: 0 0 10px rgba(255,83,112,.35); }

.nm-tool-heading { gap: 8px; }
.nm-tool-heading span { margin-bottom: 10px; color: #746c74; font-size: 9px; }
.nm-action-stack { display: grid; gap: 6px; }
.nm-action-stack button { display: flex; align-items: center; gap: 8px; justify-content: flex-start; width: 100%; min-height: 44px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.075); border-radius: 10px; background: rgba(255,255,255,.025); color: #aaa1aa; font-size: 10px; font-weight: 680; }
.nm-action-stack button:hover:not(:disabled) { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.055); color: #fff; }
.nm-action-stack button svg { width: 16px; height: 16px; flex: 0 0 16px; }
.nm-action-stack .nm-danger-action { border-color: rgba(255,102,126,.12); background: rgba(255,102,126,.06); color: #ff9aac; }
.nm-small-actions { display: grid; grid-template-columns: 44px 44px 1fr; gap: 6px; }
.nm-small-actions .nm-fit { display: flex; width: auto; justify-content: center; gap: 7px; color: #b0a7b0; font-size: 10px; font-weight: 700; }
.nm-stats dl { display: grid; gap: 7px; margin: 0; }
.nm-stats dl div { display: flex; justify-content: space-between; gap: 12px; }
.nm-stats dt { color: #7f767e; font-size: 10px; }
.nm-stats dd { margin: 0; color: #d9d2d8; font-size: 10px; font-weight: 760; font-variant-numeric: tabular-nums; }
.nm-stats .blocked dd { color: #ff8da1; }

.nm-viewport {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 52% 48%, rgba(169,147,239,.075), transparent 47%),
    #08070c;
  background-size: 24px 24px, 24px 24px, auto, auto;
}
#nmCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; outline: none; touch-action: none; }
#nmCanvas:focus-visible { box-shadow: inset 0 0 0 2px rgba(169,147,239,.72); }
.nm-viewport.is-panning #nmCanvas { cursor: grabbing; }
.nm-viewport.is-3d #nmCanvas { cursor: grab; }
.nm-viewport.is-3d.is-rotating #nmCanvas,
.nm-viewport.is-3d.is-panning #nmCanvas { cursor: grabbing; }
.nm-viewport.is-3d { background: radial-gradient(circle at 50% 44%,rgba(75,105,145,.11),transparent 54%),linear-gradient(180deg,#090a10,#06070b); }
.nm-canvas-loading { position: absolute; z-index: 4; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: rgba(8,7,12,.74); color: #bcb2bb; font-size: 11px; backdrop-filter: blur(7px); }
.nm-canvas-loading[hidden] { display: none; }
.nm-canvas-loading span { width: 26px; height: 26px; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--pink); border-radius: 50%; animation: nm-spin .75s linear infinite; }
.nm-legend,
.nm-canvas-help { position: absolute; z-index: 2; bottom: 14px; min-height: 34px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(16,14,20,.72); color: #827981; font-size: 9px; backdrop-filter: blur(12px); }
.nm-legend { left: 14px; display: flex; align-items: center; gap: 12px; }
.nm-legend span { display: flex; align-items: center; gap: 5px; }
.nm-legend i { width: 9px; height: 9px; border-radius: 3px; }
.nm-legend .normal { border: 1px solid rgba(197,185,205,.62); background: rgba(181,161,192,.22); }
.nm-legend .nm-height-legend { display: none; }
.nm-viewport.is-3d .nm-legend .nm-height-legend { display: flex; }
.nm-legend .nm-height-legend i { width: 26px; border: 1px solid rgba(174,216,255,.36); background: linear-gradient(90deg,#59647d,#8fa7ca,#c7e8ff); }
.nm-legend .blocked { border: 1px solid #ff728a; background: rgba(255,71,103,.38); }
.nm-legend .selected { border: 1px solid #9ed8ff; background: rgba(121,190,247,.36); }
.nm-canvas-help { right: 14px; display: flex; align-items: center; }
.nm-view-badge { position: absolute; z-index: 2; top: 14px; right: 14px; display: none; align-items: center; gap: 7px; min-height: 34px; padding: 7px 10px; border: 1px solid rgba(126,200,255,.18); border-radius: 11px; background: rgba(13,20,29,.72); color: #a9dcff; font-size: 9px; font-weight: 780; letter-spacing: .08em; backdrop-filter: blur(12px); }
.nm-view-badge svg { width: 15px; height: 15px; }
.nm-viewport.is-3d .nm-view-badge { display: flex; }

.nm-dialog { width: min(430px, calc(100vw - 32px)); overflow: visible; padding: 0; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; background: #17141c; color: #f8f4f7; box-shadow: 0 34px 100px rgba(0,0,0,.62); }
.nm-dialog::backdrop { background: rgba(3,2,5,.68); backdrop-filter: blur(7px); }
.nm-dialog form { display: grid; justify-items: center; padding: 28px; text-align: center; }
.nm-dialog-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--red-soft); color: #ff9aac; }
.nm-dialog-icon svg { width: 24px; height: 24px; }
.nm-dialog h3 { margin: 17px 0 7px; font-size: 19px; }
.nm-dialog p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.nm-dialog form > div:last-child { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; margin-top: 22px; }
.nm-dialog button { border: 1px solid var(--line); border-radius: 12px; color: #ddd6dc; }
.nm-dialog-cancel { background: rgba(255,255,255,.04); }
.nm-dialog-confirm { border-color: rgba(255,102,126,.22) !important; background: var(--red-soft); color: #ffb2bf !important; }
.nm-delete-dialog { width: min(400px, calc(100vw - 32px)); }
.nm-delete-dialog .nm-delete-icon { background: rgba(255,83,112,.14); color: #ff8da0; }
.nm-delete-dialog #nmDeleteCopy { max-width: 325px; }
.nm-delete-confirm { border: 1px solid rgba(255,83,112,.35) !important; background: rgba(166,38,64,.28); color: #ffc1cb !important; font-weight: 760; }
.nm-delete-confirm:hover { background: rgba(192,47,75,.38); }

@keyframes nm-spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .nm-editor { margin-inline: 0; }
  .nm-editor-shell { grid-template-columns: 244px minmax(0, 1fr); }
  .nm-save-state { display: none; }
}

@media (max-width: 820px) {
  .nm-summary-grid { grid-template-columns: 1fr; }
  .nm-market-heading { align-items: stretch; flex-direction: column; }
  .nm-search { width: 100%; }
  .nm-editor-topbar { display: grid; grid-template-columns: auto 1fr; }
  .nm-editor-save { grid-column: 1 / -1; }
  .nm-save-button { width: 100%; }
  .nm-editor-shell { display: flex; flex-direction: column; height: auto; min-height: 0; overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .nm-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; max-height: none; overflow: visible; border: 1px solid var(--line); border-radius: 16px; }
  .nm-tool-section { border-bottom: 0; }
  .nm-viewport { height: min(72vh, 620px); min-height: 480px; margin-top: 10px; border: 1px solid var(--line); border-radius: 16px; }
  .nm-canvas-help { display: none; }
}

@media (max-width: 560px) {
  .nm-heading { align-items: flex-start; flex-direction: column; }
  .nm-summary-grid { gap: 8px; }
  .nm-mine-grid,
  .nm-market-grid { grid-template-columns: 1fr; }
  .nm-mine-card { grid-template-columns: 64px minmax(0, 1fr); }
  .nm-mine-preview { width: 64px; height: 64px; }
  .nm-edit-button { grid-column: 1 / -1; width: 100%; }
  .nm-market-preview { height: 155px; }
  .nm-tools { grid-template-columns: 1fr; }
  .nm-editor-title small { max-width: 160px; }
  .nm-legend { right: 10px; left: 10px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .nm-market-card,
  .nm-mine-card,
  .nm-canvas-loading span { animation: none !important; transition: none !important; }
  .nm-market-card:hover,
  .nm-mine-card:hover { transform: none; }
}

/* NavMesh library v2 */
.nm-library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,.075); }
.nm-page-tabs { display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.025); }
.nm-page-tabs button { min-width: 146px; min-height: 42px; padding: 8px 18px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #8f858e; font-size: 12px; font-weight: 740; }
.nm-page-tabs button:hover { color: #e9e2e7; background: rgba(255,255,255,.04); }
.nm-page-tabs button.active { border-color: rgba(240,165,198,.18); background: linear-gradient(145deg, rgba(225,117,167,.18), rgba(169,147,239,.11)); color: #ffd9e9; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.nm-tab-view[hidden] { display: none !important; }
.nm-tab-view { animation: nm-tab-in .22s var(--ease) both; }
.nm-view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.nm-view-heading h2,.nm-market-heading h2 { margin: 0; color: #faf7f9; font-size: clamp(22px,2.5vw,28px); letter-spacing: -.035em; }
.nm-view-heading p,.nm-market-heading p { margin: 5px 0 0; color: #8d848c; font-size: 12px; }
.nm-new-button,.nm-map-group>header button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 15px; border: 1px solid rgba(169,147,239,.25); border-radius: 12px; background: rgba(169,147,239,.13); color: #ddd5ff; font-size: 11px; font-weight: 750; }
.nm-new-button:hover,.nm-map-group>header button:hover { border-color: rgba(169,147,239,.42); background: rgba(169,147,239,.21); }
.nm-new-button svg,.nm-map-group>header button svg { width: 16px; height: 16px; }
.nm-map-groups { display: grid; gap: 20px; }
.nm-map-group { overflow: hidden; border: 1px solid rgba(255,255,255,.085); border-radius: 18px; background: linear-gradient(145deg,rgba(28,25,34,.8),rgba(16,14,20,.78)); box-shadow: 0 18px 42px rgba(0,0,0,.17),inset 0 1px 0 rgba(255,255,255,.035); }
.nm-map-group>header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.018); }
.nm-map-group>header>div { display: flex; align-items: center; gap: 11px; min-width: 0; }
.nm-map-group>header h3 { margin: 0 0 3px; color: #f7f2f5; font-size: 15px; }
.nm-map-group>header span { color: #786f77; font-size: 10px; }
.nm-map-icon { position: relative; display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; overflow: visible; border: 0; border-radius: 0; background: transparent; color: #c9bdd2; font-size: 7px; font-weight: 800; }
.nm-map-icon.large { width: 38px; height: 38px; flex-basis: 38px; border-radius: 0; }
.nm-map-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.nm-map-icon.has-image img { opacity: 1; }
.nm-private-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 12px; padding: 14px; }
.nm-map-empty { grid-column: 1/-1; min-height: 96px; display: grid; place-items: center; color: #766d75; font-size: 11px; }
.nm-private-card { min-width: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.075); border-radius: 15px; background: rgba(10,9,14,.58); transition: border-color .2s ease,transform .22s var(--ease),box-shadow .22s var(--ease); }
.nm-private-card:hover { transform: translateY(-2px); border-color: rgba(169,147,239,.22); box-shadow: 0 16px 34px rgba(0,0,0,.22); }
.nm-private-card.is-active { border-color: rgba(112,213,170,.24); box-shadow: inset 0 0 0 1px rgba(112,213,170,.035); }
.nm-private-preview { position: relative; height: 146px; overflow: hidden; background: radial-gradient(circle at 50% 48%,rgba(169,147,239,.08),transparent 64%),#07070b; }
.nm-private-preview canvas { display: block; width: 100%; height: 100%; }
.nm-active-badge,.nm-owned-badge { position: absolute; z-index: 2; top: 10px; right: 10px; display: flex; align-items: center; min-height: 26px; padding: 5px 8px; border: 1px solid rgba(112,213,170,.22); border-radius: 999px; background: rgba(38,92,69,.7); color: #a9eace; font-size: 8px; font-weight: 820; letter-spacing: .08em; backdrop-filter: blur(10px); }
.nm-private-body { padding: 13px; }
.nm-private-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.nm-private-title h3 { min-width: 0; margin: 0; overflow: hidden; color: #f8f4f7; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.nm-private-title>span { flex: 0 0 auto; color: #877d85; font-size: 9px; font-variant-numeric: tabular-nums; }
.nm-private-meta { margin: 4px 0 0; color: #716870; font-size: 9px; }
.nm-private-stats,.nm-market-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.nm-private-stats span,.nm-market-stats span { color: #9b919a; font-size: 9px; }
.nm-private-stats .blocked,.nm-market-stats .blocked { color: #ff91a4; }
.nm-private-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(255,255,255,.065); }
.nm-private-actions button { min-width: 0; min-height: 44px; padding: 6px; border: 1px solid rgba(255,255,255,.085); border-radius: 9px; background: rgba(255,255,255,.035); color: #b7adb5; font-size: 9px; font-weight: 720; }
.nm-private-actions button:hover:not(:disabled) { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.07); color: #fff; }
.nm-private-actions .nm-activate-button:not(:disabled) { border-color: rgba(112,213,170,.16); color: #a5dfc5; }
.nm-private-actions .nm-publish-button { border-color: rgba(169,147,239,.18); color: #cbbff1; }
.nm-private-actions .nm-publish-button.update { border-color: rgba(239,187,112,.22); background: rgba(239,187,112,.08); color: #f3ca8b; }
.nm-private-actions .nm-delete-personal { border-color: rgba(255,83,112,.18); color: #ef9cac; }
.nm-market-heading { align-items: flex-end; margin-bottom: 14px; }
.nm-market-grid { grid-template-columns: repeat(auto-fill,minmax(275px,1fr)); gap: 13px; }
.nm-market-title h3 { margin: 0; overflow: hidden; color: #fff; font-size: 14px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.nm-market-title>span { color: #9f91cc; font-size: 9px; font-weight: 760; }
.nm-map-badge { min-height: 24px; padding: 0; border: 0; border-radius: 0; background: transparent; backdrop-filter: none; }
.nm-map-badge .nm-map-icon { border: 0; background: transparent; }
.nm-owned-badge { border-color: rgba(169,147,239,.24); background: rgba(74,54,119,.68); color: #d9cdff; }
.nm-market-author { margin: 11px 0; }
.nm-market-author>div { display: grid; gap: 2px; }
.nm-market-author>div>span { color: #d2c9d0; font-size: 11px; font-weight: 680; }
.nm-market-author small { color: #716870; font-size: 9px; }
.nm-author-avatar { position: relative; display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; overflow: hidden; border: 1px solid rgba(255,255,255,.10); border-radius: 9px; background: linear-gradient(145deg,#a55d83,#67469a); color: #fff; font-size: 10px; font-weight: 820; }
.nm-author-avatar svg { width: 15px; height: 15px; }
.nm-author-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.nm-author-avatar.has-image img { opacity: 1; }
.nm-market-stats { margin: 0 0 12px; }
.nm-market-stats .installs { display: flex; align-items: center; gap: 4px; margin-left: auto; color: #a99fc0; }
.nm-market-stats .installs svg { width: 13px; height: 13px; }
.nm-market-footer>span { color: #746b73; font-size: 9px; }
.nm-market-footer { flex-wrap: wrap; }
.nm-market-footer>span { margin-right: auto; }
.nm-market-remove { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 8px 11px; border: 1px solid rgba(255,83,112,.2); border-radius: 10px; background: rgba(255,83,112,.07); color: #e99aaa; font-size: 9px; font-weight: 760; }
.nm-market-remove svg { width: 13px; height: 13px; }
.nm-market-remove:hover { border-color: rgba(255,83,112,.36); background: rgba(255,83,112,.13); color: #ffc2cc; }
.nm-use-button { min-width: 80px; }
.nm-use-button.got { border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.035); color: #8c838b; }
.nm-use-button.update { border-color: rgba(239,187,112,.24); background: rgba(239,187,112,.11); color: #f5cb8b; }
.nm-create-dialog form { justify-items: stretch; text-align: left; }
.nm-create-dialog .nm-dialog-icon { justify-self: center; }
.nm-create-dialog h3,.nm-create-dialog>form>p { text-align: center; }
.nm-create-dialog label { width: 100%; margin: 16px 0 0; color: #aaa0a8; font-size: 10px; }
.nm-create-dialog label+label { margin-top: 10px; }
.nm-map-chip { overflow: hidden; }
.nm-map-chip img { width: 100%; height: 100%; object-fit: cover; }
@keyframes nm-tab-in { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media(max-width:700px){
  .nm-library-toolbar { align-items: stretch; }
  .nm-page-tabs { flex: 1; }
  .nm-page-tabs button { min-width: 0; flex: 1; padding-inline: 10px; }
  .nm-view-heading,.nm-market-heading { align-items: stretch; flex-direction: column; }
  .nm-new-button { width: 100%; }
  .nm-private-grid,.nm-market-grid { grid-template-columns: 1fr; }
  .nm-map-group>header { align-items: center; }
  .nm-map-group>header button { min-width: 72px; }
}

@media(max-width:820px){.nm-market-heading{align-items:stretch;flex-direction:column}}

@media(prefers-reduced-motion:reduce){.nm-tab-view,.nm-private-card{animation:none;transition:none}.nm-private-card:hover{transform:none}}
