/* nimrodcore — interactive menu replica.
   Port of MenuPreview/src/system/features/menu (style.hpp + widgets.hpp) to the DOM.
   Sizes and colours mirror the ImGui source 1:1; see style.hpp for the originals. */

@font-face {
    font-family: 'NmInter';
    src: url('/redesign/fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

/* ---------- section + stage ---------- */
.ifc { position: relative; padding: 160px 0 120px; border-top: 1px solid var(--line); }
.ifc-stage-wrap { width: min(100vw - 32px, 1560px); margin: 0 auto; }

.ifc-stage {
    --cx: 70%;
    position: relative;
    height: clamp(640px, 52vw, 780px);
    border: 1px solid var(--line);
    background: #06080b;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.ifc-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ifc-scene.bright { filter: brightness(1.55) contrast(.95); }

.ifc-bar {
    display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between;
    padding: 14px 0 0;
    font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .04em;
}
.ifc-bar kbd {
    font-family: var(--mono); font-size: 10px; color: var(--fg);
    border: 1px solid var(--line-s); padding: 1px 6px; margin-right: 6px;
}
.ifc-accent { display: flex; align-items: center; gap: 6px; }
.ifc-accent span { margin-right: 6px; }
.ifc-accent button {
    width: 18px; height: 18px; border-radius: 4px; background: var(--c);
    outline: 1px solid transparent; outline-offset: 2px;
    transition: outline-color .15s cubic-bezier(.23,1,.32,1), transform .1s;
}
.ifc-accent button:active { transform: scale(.92); }
.ifc-accent button[aria-pressed="true"] { outline-color: var(--fg); }

.ifc-hidden-hint {
    position: absolute; left: 24px; bottom: 24px; z-index: 6;
    font-family: var(--mono); font-size: 11px; color: var(--muted);
    border: 1px solid var(--line-s); background: rgba(0,0,0,.6); padding: 8px 12px;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ifc-stage.menu-off .ifc-hidden-hint { opacity: 1; pointer-events: auto; cursor: pointer; }

/* menu frame: positioned + scaled container for the 780x580 window */
.nm-frame {
    position: absolute; left: 40px; top: 50%;
    width: calc(780px * var(--s, 1)); height: calc(580px * var(--s, 1));
    transform: translateY(-50%);
    z-index: 5;
    transition: opacity .18s cubic-bezier(.23,1,.32,1);
}
.nm-frame.dragged { transform: none; }
.ifc-stage.menu-off .nm-frame { opacity: 0; pointer-events: none; }

/* stacked layout (narrow screens): scene on top, menu below */
.ifc-stage-wrap.stacked .ifc-stage { --cx: 50%; height: auto; aspect-ratio: 16 / 9; }
.ifc-stage-wrap.stacked .nm-frame { position: relative; left: auto; top: auto; transform: none; margin: 16px auto 0; }
.ifc-stage-wrap.stacked .ifc-hidden-hint { display: none; }

/* toasts (menu_c::render_toasts) */
.nm-toasts { position: absolute; right: 16px; top: 16px; z-index: 8; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.nm-toast {
    display: flex; align-items: center; gap: 8px;
    font: 11.5px/1 'NmInter', sans-serif; color: #ECEDF0;
    background: #0D1119; border: 1px solid #232A3A; border-radius: 6px;
    padding: 9px 12px 9px 10px;
    animation: nm-toast-in .22s cubic-bezier(.23,1,.32,1);
}
.nm-toast::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--tc, var(--nm-accent)); }
.nm-toast.out { opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }
@keyframes nm-toast-in { from { opacity: 0; transform: translateX(12px); } }

/* ---------- the menu window ---------- */
.nm {
    --nm-accent: #8B6CF7;
    --nm-accent-hov: #A289F9;
    --nm-accent-act: #644EB2;
    --nm-accent-soft: rgba(139, 108, 247, .14);
    --nm-accent-glow: rgba(139, 108, 247, .35);
    --nm-accent-bg: #0C0A16;

    --nm-text: #ECEDF0;
    --nm-dim: #A4A6B0;
    --nm-mute: #64666F;
    --nm-faint: #3E404A;

    --nm-deep: #0A0D14;
    --nm-brd-sub: #2A3142;
    --nm-brd-fine: #1C2230;
    --nm-track-brd: #1A2030;

    position: absolute; left: 0; top: 0;
    width: 780px; height: 580px;
    transform: scale(var(--s, 1)); transform-origin: 0 0;
    background: #0A0D11;
    border: 1px solid #181D24;
    border-radius: 8px;
    box-shadow: 0 30px 80px rgba(0,0,0,.55);
    font: 11.5px/1.2 'NmInter', 'Inter', system-ui, sans-serif;
    color: var(--nm-text);
    overflow: hidden;
    cursor: default;
}
:where(.nm) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.nm-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; }

/* titlebar */
.nm-title {
    position: relative; height: 42px;
    background: #0C0F13; border-bottom: 1px solid #161A21;
    display: flex; align-items: center;
    cursor: grab;
}
.nm-title:active { cursor: grabbing; }
.ifc-stage-wrap.stacked .nm-title { cursor: default; }
.nm-logo { height: 30px; width: auto; margin-left: 10px; pointer-events: none; }
.nm-brand { margin-left: 8px; font-size: 13.5px; pointer-events: none; white-space: nowrap; }
.nm-brand small { font-size: 11.5px; color: var(--nm-faint); }

.nm-rail {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    display: flex; gap: 2px; padding: 3px;
    background: #07090C; border: 1px solid #161A21; border-radius: 999px;
}
.nm-rail-ind {
    position: absolute; top: 3px; bottom: 3px; left: 0; width: 0;
    background: var(--nm-accent); border-radius: 999px;
    transition: left .2s cubic-bezier(.23,1,.32,1), width .2s cubic-bezier(.23,1,.32,1);
}
.nm-pill {
    position: relative; z-index: 1;
    height: 21.5px; padding: 0 12px; border-radius: 999px;
    color: var(--nm-dim); transition: color .15s;
}
.nm-pill:hover { color: var(--nm-text); }
.nm-pill.on { color: var(--nm-accent-bg); }

.nm-search-btn {
    position: absolute; right: 12px; top: 10px; width: 22px; height: 22px; border-radius: 4px;
    display: grid; place-items: center; color: var(--nm-dim);
}
.nm-search-btn:hover, .nm-search-btn.on { background: #1A2030; color: var(--nm-accent); }

/* search (render_search_bar) */
.nm-search {
    position: absolute; left: 50%; top: 7px; width: 360px; transform: translateX(-50%);
    z-index: 20; display: none;
}
.nm.searching .nm-search { display: block; }
.nm.searching .nm-rail { display: none; }
.nm-search input {
    width: 100%; height: 28px; padding: 0 12px;
    background: var(--nm-deep); border: 1px solid var(--nm-accent); border-radius: 999px;
    color: var(--nm-text); font: inherit; outline: none; caret-color: var(--nm-accent);
}
.nm-search input::placeholder { color: var(--nm-mute); }
.nm-search-res {
    margin-top: 6px; background: #0D1119; border: 1px solid #232A3A; border-radius: 6px;
    padding: 4px; max-height: 260px; overflow-y: auto;
}
.nm-search-res:empty { display: none; }
.nm-search-res button {
    display: flex; justify-content: space-between; width: 100%; text-align: left;
    padding: 7px 10px; border-radius: 4px; color: var(--nm-dim);
}
.nm-search-res button b { font-weight: 400; color: var(--nm-text); }
.nm-search-res button span { color: var(--nm-faint); }
.nm-search-res button:hover, .nm-search-res button.hov { background: #141926; }

/* body */
.nm-body {
    position: absolute; left: 10px; right: 10px; top: 50px; bottom: 10px;
    display: flex; flex-direction: column; gap: 6px;
}

/* Segmented — the sub-tab bar */
.nm-seg {
    display: flex; gap: 2px; padding: 2px; height: 28px; flex: none;
    background: #07090C; border: 1px solid #161A21; border-radius: 4px;
}
.nm-seg button { flex: 1; border-radius: 3px; color: var(--nm-faint); transition: color .15s, background .15s; }
.nm-seg button:hover { color: var(--nm-dim); }
.nm-seg button.on { background: #161A21; color: var(--nm-accent); }

/* TwoGroups / BeginGroup */
.nm-groups { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nm-groups.one { grid-template-columns: 1fr; }
.nm-group {
    display: flex; flex-direction: column; min-height: 0;
    background: #0C0F13; border: 1px solid #181D24; border-radius: 6px;
}
.nm-group-hdr {
    flex: none; height: 30px; padding: 0 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #161A21; font-size: 11px;
}
.nm-group-hdr .nm-mono { color: var(--nm-faint); }
.nm-group-body {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 16px 10px; display: flex; flex-direction: column; gap: 6px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
}
.nm-group-body::-webkit-scrollbar { width: 6px; }
.nm-group-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 99px; }
.nm-group-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }

/* row base */
.nm-row { position: relative; flex: none; min-height: 26px; display: flex; align-items: center; gap: 10px; color: var(--nm-dim); }
.nm-row .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nm-row.flash { animation: nm-flash .9s ease-out; }
@keyframes nm-flash { 0%, 40% { background: var(--nm-accent-soft); box-shadow: 0 0 0 4px var(--nm-accent-soft); } }

/* Toggle */
.nm-tgl { cursor: pointer; }
.nm-box {
    flex: none; width: 18px; height: 18px; border-radius: 4px;
    background: var(--nm-deep); border: 1px solid var(--nm-brd-sub);
    transition: background .12s, border-color .12s;
}
.nm-tgl.on { color: var(--nm-text); }
.nm-tgl.on .nm-box { background: var(--nm-accent); border-color: var(--nm-accent); }
.nm-tgl.pulse .nm-box { animation: nm-pulse .28s ease-out; }
@keyframes nm-pulse { 50% { transform: scale(1.2); } }

/* ToggleCog */
.nm-cog { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--nm-mute); }
.nm-cog:hover, .nm-cog.on { color: var(--nm-accent); background: #141926; }

/* Slider */
.nm-sl { flex-direction: column; align-items: stretch; gap: 6px; min-height: 0; padding-bottom: 8px; }
.nm-sl-top { display: flex; justify-content: space-between; }
.nm-sl-top .nm-mono { color: var(--nm-accent); }
.nm-sl-track {
    position: relative; height: 4px; border-radius: 3px;
    background: var(--nm-deep); box-shadow: inset 0 0 0 1px var(--nm-track-brd);
    cursor: pointer; touch-action: none;
}
.nm-sl-track::before { content: ''; position: absolute; inset: -8px -6px; }
.nm-sl-fill {
    position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px;
    background: linear-gradient(90deg, var(--nm-accent-act), var(--nm-accent));
    box-shadow: 0 0 6px var(--nm-accent-glow);
}
.nm-sl-thumb {
    position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    border-radius: 50%; background: #fff;
}

/* Combo */
.nm-combo { flex-direction: column; align-items: stretch; gap: 6px; padding-bottom: 4px; }
.nm-combo-btn {
    height: 28px; padding: 0 10px; border-radius: 3px;
    background: var(--nm-deep); border: 1px solid var(--nm-brd-fine) !important;
    display: flex; align-items: center; justify-content: space-between;
    color: var(--nm-text) !important; text-align: left;
}
.nm-combo-btn.open { border-color: var(--nm-accent) !important; }
.nm-combo-btn svg { color: var(--nm-dim); transition: transform .15s; }
.nm-combo-btn.open svg { transform: rotate(180deg); color: var(--nm-accent); }

/* InlineSegmented */
.nm-iseg {
    flex: none; display: flex; gap: 2px; padding: 2px; height: 22px;
    background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.08); border-radius: 6px;
}
.nm-iseg button { padding: 0 9px; border-radius: 4px; color: var(--nm-dim); }
.nm-iseg button:hover { color: var(--nm-text); }
.nm-iseg button.on { background: var(--nm-accent); color: var(--nm-accent-bg); }

/* ColorSwatch */
.nm-sw { flex: none; width: 36px; height: 16px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px var(--nm-brd-sub); }
.nm-sw.open { box-shadow: inset 0 0 0 1px var(--nm-accent); }

/* Hotkey */
.nm-key {
    flex: none; min-width: 56px; height: 20px; padding: 0 8px; border-radius: 3px;
    background: var(--nm-deep); border: 1px solid var(--nm-brd-fine) !important;
    color: var(--nm-dim) !important; text-align: center;
}
.nm-key:hover { color: var(--nm-text) !important; }
.nm-key.listen { border-color: var(--nm-accent) !important; color: var(--nm-accent) !important; }

/* info rows / progress_bar */
.nm-info .val { color: var(--nm-dim); }
.nm-info .val.good { color: #4ADE80; }
.nm-prog { flex: none; position: relative; width: 120px; height: 14px; border-radius: 3px; background: var(--nm-deep); box-shadow: inset 0 0 0 1px var(--nm-track-brd); overflow: hidden; }
.nm-prog i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--nm-accent-act), var(--nm-accent)); }
.nm-prog span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--nm-text); font-size: 9.5px; }

/* buttons (widgets::button) */
.nm-btns { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.nm-btn {
    flex: 1; height: 28px; padding: 0 12px; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--nm-deep); border: 1px solid var(--nm-brd-fine) !important; color: var(--nm-dim) !important;
    transition: background .12s, color .12s, transform .1s;
}
.nm-btn:hover { background: #141926; color: var(--nm-text) !important; }
.nm-btn:active { transform: scale(.97); }
.nm-btn.primary { background: var(--nm-accent); border-color: var(--nm-accent) !important; color: var(--nm-accent-bg) !important; }
.nm-btn.primary:hover { background: var(--nm-accent-hov); }
.nm-btn.danger:hover { color: #E05A5A !important; border-color: rgba(224,90,90,.4) !important; }

.nm-input {
    flex: 1; height: 28px; padding: 0 10px; border-radius: 4px;
    background: var(--nm-deep); border: 1px solid var(--nm-brd-fine); color: var(--nm-text);
    font: inherit; outline: none; caret-color: var(--nm-accent);
}
.nm-input:focus { border-color: var(--nm-accent); }

/* config list */
.nm-cfg-list { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid #161A21; border-radius: 4px; padding: 4px; background: #0A0D11; }
.nm-cfg-item { display: flex; justify-content: space-between; width: 100%; padding: 8px 10px; border-radius: 4px; color: var(--nm-dim); }
.nm-cfg-item:hover { background: #141926; color: var(--nm-text); }
.nm-cfg-item.on { background: var(--nm-accent-soft); color: var(--nm-text); }
.nm-cfg-item.on .nm-mono { color: var(--nm-accent); }
.nm-cfg-item .nm-mono { color: var(--nm-faint); }

/* radar preview */
.nm-radar-prev { flex: 1; display: grid; place-items: center; min-height: 0; }

/* popups (combo list, colour picker, cog popups) */
.nm-pop {
    position: absolute; z-index: 30;
    background: #0D1119; border: 1px solid #232A3A; border-radius: 6px;
    padding: 4px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
    transform-origin: top center;
    animation: nm-pop-in .14s cubic-bezier(.23,1,.32,1);
}
@keyframes nm-pop-in { from { opacity: 0; transform: scale(.95); } }
.nm-pop-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 4px; color: var(--nm-dim); }
.nm-pop-item:hover { background: #141926; color: var(--nm-text); }
.nm-pop-item.on { color: var(--nm-accent); }
.nm-pop.pad { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.nm-pal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.nm-pal button { height: 20px; border-radius: 4px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nm-pal button.on { box-shadow: 0 0 0 1px #0D1119, 0 0 0 2px var(--nm-text); }
.nm-hex { display: flex; align-items: center; justify-content: space-between; color: var(--nm-dim); }
.nm-hex input[type=color] { width: 36px; height: 18px; border: 0; padding: 0; background: none; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .nm *, .ifc-stage * { animation: none !important; transition: none !important; }
}

@media (max-width: 900px) {
    .ifc { padding: 90px 0 80px; }
}
