:root {
  --bg: #0b0e12;
  --bg-elev: #12161c;
  --bg-card: #151a21;
  --line: #272e39;
  --line-strong: #3c4554;
  --text: #e6ebf2;
  --text-dim: #95a0b2;
  --text-muted: #6c7686;

  /* ZERAPHYM / EFTool Signature Accent */
  --accent: #d9e853;
  --accent-bright: #f3ff79;
  --accent-22: rgba(217, 232, 83, 0.22);
  --accent-38: rgba(217, 232, 83, 0.38);
  --accent-55: rgba(217, 232, 83, 0.55);
  --accent-12: rgba(217, 232, 83, 0.12);
  --accent-ink: #111408;

  /* ImGui Exact Surface Tokens */
  --im-win: rgba(19, 22, 26, 0.96);
  --im-child: rgba(14, 16, 20, 0.92);
  --im-title: #16191f;
  --im-border: #404754;
  --im-frame: #242930;
  --im-frame-hover: #303640;
  --im-frame-active: #3d454f;
  --im-btn: #2e333d;
  --im-bad: #ff6b61;
  --im-req: #f29e40;
  --im-ok: #73d973;
  --im-blue: #73b8ff;
  --im-yellow: #f2cc4d;
  --im-font-scale: 1;

  --font-sans: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

/* Subtle Tactical Atmosphere */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(680px circle at 50% 0%, rgba(217, 232, 83, 0.08), transparent 65%);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 14, 18, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #161b22;
  border: 1px solid var(--line-strong);
}

.brand-mark img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.08em;
}

.brand-text small {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-dim);
  transition: color 150ms ease, background 150ms ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-12);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: border-color 150ms ease, color 150ms ease;
}

.version-pill:hover {
  border-color: var(--accent-55);
  color: var(--text);
}

.version-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* Generic Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(217, 232, 83, 0.14);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: var(--accent-ink);
}

.btn-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}

/* Main Shell */
.shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 56px;
  flex: 1;
}

/* Product Switcher Bar */
.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.product-switch {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 160ms ease;
}

.switch-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.switch-btn.active {
  background: var(--accent-22);
  border-color: var(--accent-55);
  color: var(--text);
}

.switch-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
}

.switch-btn.active .switch-tag {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.switch-name {
  font-size: 14.5px;
  font-weight: 700;
}

.switch-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.switch-btn.active .switch-meta {
  color: var(--accent);
}

.stage-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 150ms ease;
}

.tool-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.tool-chip[aria-pressed="true"] {
  border-color: var(--accent-55);
  color: var(--accent);
  background: var(--accent-12);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* =========================================================
   MOD STAGE & PIXEL-FAITHFUL DEAR IMGUI WINDOW
   ========================================================= */
.mod-stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 20%, rgba(217, 232, 83, 0.05), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(115, 184, 255, 0.04), transparent 45%),
    #090c10;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  min-height: 690px;
}

/* Top-center ImGui Toast Stack */
.imgui-toast-stack {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.imgui-toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 11px;
  border-radius: 8px;
  background: rgba(16, 20, 26, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent);
  color: #ebeef2;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn 160ms ease;
}

.imgui-toast.off {
  border-left-color: #be5a55;
}

.imgui-toast.neutral {
  border-left-color: #96a5b9;
}

.imgui-toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.imgui-toast.off .imgui-toast-dot {
  background: #be5a55;
}

.imgui-toast.neutral .imgui-toast-dot {
  background: #96a5b9;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Floating ImGui HUD */
.imgui-hud {
  width: 210px;
  flex-shrink: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(14, 18, 24, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.imgui-hud[hidden] {
  display: none;
}

.imgui-hud-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}

.imgui-hud-title.paused {
  color: var(--im-bad);
}

.imgui-hud-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.imgui-hud-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.imgui-hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #ebeef2;
}

.imgui-hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.imgui-hud-val {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-left: auto;
}

.imgui-hud-empty {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Fixed-aspect-ratio viewport wrapper (exact 860x640 ImGui proportion, scales cleanly without distortion) */
.imgui-viewport {
  position: relative;
  width: 860px;
  height: 640px;
  max-width: 100%;
  flex-shrink: 0;
  overflow: visible;
}

/* Main ImGui Window (exact 860 x 640 native ratio) */
.imgui-window {
  width: 860px;
  height: 640px;
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  border: 1px solid var(--im-border);
  background: var(--im-win);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  font-size: calc(14px * var(--im-font-scale));
}

.imgui-titlebar {
  height: 32px;
  padding: 0 10px 0 12px;
  background: var(--im-title);
  border-bottom: 1px solid #2b3038;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  user-select: none;
}

.imgui-title-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.imgui-title-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.imgui-hotkey-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.imgui-close-btn {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.imgui-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.imgui-banner {
  padding: 7px 14px;
  font-size: 12.5px;
  background: rgba(255, 107, 97, 0.12);
  border-bottom: 1px solid rgba(255, 107, 97, 0.3);
  color: var(--im-bad);
}

.imgui-body {
  flex: 1;
  min-height: 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  gap: 10px;
}

/* Left Sidebar */
.imgui-sidebar {
  background: var(--im-child);
  border: 1px solid var(--im-border);
  border-radius: 4px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.imgui-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0 10px;
}

.imgui-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.imgui-brand span {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--text);
}

.imgui-sep {
  height: 1px;
  background: #313742;
  margin: 6px 0 8px;
  flex-shrink: 0;
}

.imgui-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.imgui-nav-group {
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 6px 3px;
}

.imgui-nav-group:first-child {
  padding-top: 2px;
}

.imgui-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.imgui-nav-item:hover {
  background: var(--accent-22);
}

.imgui-nav-item.active {
  background: var(--accent-22);
  color: #fff;
}

.imgui-nav-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* Right Main Content */
.imgui-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-right: 2px;
}

.imgui-page-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.imgui-page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.imgui-page-blurb {
  font-size: 13px;
  color: var(--text-dim);
}

.imgui-page-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Custom Dark Scrollbars for ImGui */
.imgui-sidebar::-webkit-scrollbar,
.imgui-page-content::-webkit-scrollbar,
.im-scrollbox::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.imgui-sidebar::-webkit-scrollbar-track,
.imgui-page-content::-webkit-scrollbar-track,
.im-scrollbox::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.imgui-sidebar::-webkit-scrollbar-thumb,
.imgui-page-content::-webkit-scrollbar-thumb,
.im-scrollbox::-webkit-scrollbar-thumb {
  background: #3b424d;
  border-radius: 4px;
}

.imgui-sidebar::-webkit-scrollbar-thumb:hover,
.imgui-page-content::-webkit-scrollbar-thumb:hover,
.im-scrollbox::-webkit-scrollbar-thumb:hover {
  background: #535c6b;
}

/* ImGui Collapsing Section */
.im-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.im-sec-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--accent-22);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.im-sec-head:hover {
  background: var(--accent-38);
}

.im-sec-arrow {
  display: inline-block;
  font-size: 10px;
  transition: transform 140ms ease;
}

.im-section.collapsed .im-sec-arrow {
  transform: rotate(-90deg);
}

.im-sec-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 2px 2px 6px;
}

.im-section.collapsed .im-sec-body {
  display: none;
}

/* ImGui Feature Row */
.im-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.im-row-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.im-row-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.im-req-tag {
  font-size: 11.5px;
  color: var(--im-req);
  font-weight: 600;
}

/* ImGui Checkbox */
.im-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.im-check.disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.im-check input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 21px;
  height: 21px;
  border-radius: 4px;
  background: var(--im-frame);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease;
}

.im-check:hover input:not(:disabled) {
  background: var(--im-frame-hover);
}

.im-check input:checked::after {
  content: "";
  width: 13px;
  height: 13px;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 8.5L6.5 12.5L13.5 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 8.5L6.5 12.5L13.5 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ImGui Buttons & Hotkeys */
.im-btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: 0;
  background: var(--im-btn);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.im-btn:hover:not(:disabled) {
  background: rgba(217, 232, 83, 0.78);
  color: var(--accent-ink);
}

.im-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.im-btn.small {
  padding: 3px 9px;
  font-size: 12px;
}

.im-btn.accent {
  background: var(--accent-22);
  color: var(--accent);
  border: 1px solid var(--accent-55);
}

.im-btn.accent:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-ink);
}

.im-hotkey-btn {
  min-width: 148px;
  padding: 5px 10px;
  border-radius: 4px;
  border: 0;
  background: var(--im-btn);
  color: var(--text);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.im-hotkey-btn:hover:not(:disabled) {
  background: var(--im-frame-active);
}

.im-hotkey-btn.listening {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.im-hotkey-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ImGui Select / Combo */
.im-select {
  padding: 4px 26px 4px 9px;
  border-radius: 4px;
  border: 0;
  background-color: var(--im-frame);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23e6ebf2' d='M2.5 4.2L6 8.2L9.5 4.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  appearance: none;
  -webkit-appearance: none;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  min-width: 92px;
}

.im-select:hover {
  background-color: var(--im-frame-hover);
}

.im-select option {
  background: #1b2028;
  color: var(--text);
}

/* Indented Sub-Parameters */
.im-params {
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ImGui Slider */
.im-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.im-slider-wrap {
  position: relative;
  width: 230px;
  height: 24px;
  border-radius: 4px;
  background: var(--im-frame);
  display: flex;
  align-items: center;
}

.im-slider-wrap:hover {
  background: var(--im-frame-hover);
}

.im-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  background: transparent;
  margin: 0;
  padding: 0 3px;
  cursor: ew-resize;
  position: relative;
  z-index: 2;
}

.im-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  border: 0;
  cursor: ew-resize;
}

.im-slider::-webkit-slider-thumb:active {
  background: var(--accent-bright);
}

.im-slider::-moz-range-thumb {
  width: 12px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  border: 0;
  cursor: ew-resize;
}

.im-slider-val {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  color: var(--text);
  pointer-events: none;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.im-control-label {
  font-size: 13px;
  color: var(--text);
}

/* ImGui Input */
.im-input {
  padding: 4px 9px;
  border-radius: 4px;
  border: 0;
  background: var(--im-frame);
  color: var(--text);
  font-size: 13px;
  width: 200px;
}

.im-input:focus {
  outline: 1px solid var(--accent-55);
  background: var(--im-frame-hover);
}

.im-input.num {
  width: 100px;
}

.im-input.wide {
  width: 250px;
}

.im-inline-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.im-dim {
  font-size: 12.5px;
  color: var(--text-dim);
}

.im-status {
  font-size: 12.5px;
  color: var(--text-dim);
}

.im-status.on {
  color: var(--accent);
}

.im-status.ok {
  color: var(--im-ok);
}

.im-status.bad {
  color: var(--im-bad);
}

.im-status.blue {
  color: var(--im-blue);
}

.im-status.yellow {
  color: var(--im-yellow);
}

/* ImGui Tree / Sub-Details */
.im-tree {
  border-radius: 4px;
}

.im-tree > summary {
  cursor: pointer;
  list-style: none;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.im-tree > summary::-webkit-details-marker {
  display: none;
}

.im-tree > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 11px;
  display: inline-block;
  transition: transform 120ms ease;
}

.im-tree[open] > summary::before {
  transform: rotate(90deg);
}

.im-tree > summary:hover {
  background: var(--accent-12);
}

.im-tree-body {
  padding: 6px 0 4px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.im-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 10px;
}

.im-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  margin-left: 4px;
}

/* ImGui Scrollbox & Tables */
.im-scrollbox {
  border: 1px solid #303744;
  border-radius: 4px;
  background: var(--im-child);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.im-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.im-table th {
  text-align: left;
  padding: 5px 8px;
  background: #1d222b;
  color: var(--text-dim);
  border-bottom: 1px solid #303744;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.im-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.im-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.im-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.im-pill.ok { color: var(--im-ok); background: rgba(115, 217, 115, 0.14); }
.im-pill.blue { color: var(--im-blue); background: rgba(115, 184, 255, 0.14); }
.im-pill.yellow { color: var(--im-yellow); background: rgba(242, 204, 77, 0.14); }
.im-pill.bad { color: var(--im-bad); background: rgba(255, 107, 97, 0.14); }

.im-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.im-color-chip {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
}

.im-color-chip.active {
  border-color: #fff;
}

.im-color-chip.c-lime { background: #d9e853; }
.im-color-chip.c-cyan { background: #4de0d8; }
.im-color-chip.c-blue { background: #64a8ff; }
.im-color-chip.c-amber { background: #f5b342; }
.im-color-chip.c-coral { background: #ff7a6b; }

/* Card Purchase Channels Section */
.channels-section {
  margin-top: 28px;
}

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.section-bar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.meta-label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 12px;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.channel-card:hover {
  border-color: var(--accent-55);
  background: #1a2029;
  transform: translateY(-1px);
}

.channel-idx {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--accent-12);
}

.channel-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.channel-info strong {
  font-size: 14px;
}

.channel-info small {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-arrow {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 15px;
}

.channel-card:hover .channel-arrow {
  color: var(--accent);
}

/* =========================================================
   STANDALONE DOWNLOAD PAGE (download.html)
   ========================================================= */
.dl-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.dl-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 6px;
}

.dl-hero h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.dl-sub {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 14px;
  max-width: 680px;
}

.dl-actions-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 18px;
  align-items: start;
}

.dl-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.dl-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dl-version-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.25;
}

.dl-version-num.compact {
  font-size: 20px;
}

.dl-ver-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-12);
  border: 1px solid var(--accent-38);
  vertical-align: middle;
}

.dl-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-12);
  color: var(--accent);
  border: 1px solid var(--accent-38);
}

.dl-status-badge.error {
  background: rgba(255, 107, 97, 0.14);
  color: var(--im-bad);
  border-color: rgba(255, 107, 97, 0.35);
}

.dl-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

.dl-meta-grid dt {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.dl-meta-grid dd {
  margin: 0;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
}

.dl-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.dl-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

.dl-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dl-file-info strong {
  font-size: 14.5px;
}

.dl-file-info span {
  font-size: 12.5px;
  color: var(--text-dim);
}

.dl-file-info small {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
}

.dl-pending {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.dl-dist-note {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.dl-checksum {
  padding: 12px;
  border-radius: 8px;
  background: #0d1015;
  border: 1px solid var(--line);
}

.dl-checksum-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.dl-checksum pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
}

.dl-changelog-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.dl-changelog-body {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  min-height: 140px;
}

.dl-log-card {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

.dl-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.dl-log-head strong {
  font-size: 13.5px;
  color: var(--accent);
}

.dl-log-text {
  margin: 0;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.dl-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.dl-step {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.dl-step span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
}

.dl-step h3 {
  margin: 4px 0 6px;
  font-size: 14.5px;
}

.dl-step p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* Lightbox */
.lightbox {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #10141a;
  color: var(--text);
  max-width: min(94vw, 960px);
  max-height: 90vh;
}

.lightbox::backdrop {
  background: rgba(5, 7, 10, 0.82);
  backdrop-filter: blur(4px);
}

.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.lightbox-body {
  padding: 14px;
  display: grid;
  place-items: center;
}

.lightbox-body img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 6px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(11, 14, 18, 0.7);
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-brand img {
  display: block;
  height: 36px;
  width: auto;
}

.footer-links {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-links a:hover {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 1140px) {
  .mod-stage {
    flex-direction: column;
    align-items: center;
  }
  .imgui-hud {
    width: min(100%, 920px);
  }
  .imgui-hud-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
}

@media (max-width: 860px) {
  .dl-grid {
    grid-template-columns: 1fr;
  }
  .dl-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dl-steps,
  .channel-grid {
    grid-template-columns: 1fr;
  }
  .topbar-actions .version-pill {
    display: none;
  }
}

@media (max-width: 560px) {
  .topnav {
    display: none;
  }
}
