/* MODZGPX Nesting — dark UI. Everything is scoped under .mgn; doubled .mgn.mgn beats the theme's dark-mode input styles. */
.mgn {
  --bg: #0b0d12; --canvas: #0f1218; --panel: #12151c; --card: #181c25; --card-2: #1f2430;
  --line: #2a3040; --line-2: #363d50; --text: #e7e9ee; --muted: #8b93a7; --faint: #5d6579;
  --accent: #e11d48; --accent-2: #ff4d6d; --ok: #22c55e; --warn: #f43f5e; --radius: 10px;
  color-scheme: dark; display: flex; height: min(86vh, 920px); min-height: 560px; overflow: hidden;
  font: 13px/1.45 Inter, "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 14px; text-align: left;
}
.mgn * { box-sizing: border-box; }
/* edge to edge on the page: no rounded box, fill the screen under the header */
.mgn.alignfull { border-radius: 0; border-left: 0; border-right: 0; height: calc(100vh - 80px); max-height: none; } /* 78px header + 2px border */
.mgn .mgn-view { flex: 1; position: relative; min-width: 0; background: radial-gradient(circle at 1px 1px, #1a1f2a 1px, transparent 0) 0 0 / 22px 22px, var(--canvas); }
.mgn canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.mgn canvas:active { cursor: grabbing; }
.mgn #drop { position: absolute; inset: 24px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; pointer-events: none; border: 2px dashed var(--line-2); border-radius: 18px; }
.mgn #drop svg { width: 46px; height: 46px; color: var(--faint); }
.mgn #drop small { color: var(--faint); }
.mgn .mgn-view.drag #drop { border-color: var(--accent); color: var(--text); background: rgba(225, 29, 72, .06); }
.mgn #hud { position: absolute; left: 14px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(24, 28, 37, .85);
  border: 1px solid var(--line); color: var(--muted); font-size: 12px; backdrop-filter: blur(6px); }
.mgn #hud:empty { display: none; }
.mgn #zoomhint { position: absolute; right: 14px; bottom: 12px; color: var(--faint); font-size: 11px; }

.mgn aside { width: 330px; flex: none; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.mgn header { display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; background: none; border: 0; position: static; }
.mgn .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #7c3aed); display: grid; place-items: center; flex: none; }
.mgn .logo svg { width: 18px; height: 18px; color: #fff; }
.mgn.mgn h1 { font-size: 15px; line-height: 1.3; margin: 0; letter-spacing: .2px; color: var(--text); font-family: inherit; }
.mgn header p { margin: 0; color: var(--muted); font-size: 11.5px; }

.mgn .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; }
.mgn.mgn h2 { margin: 0 0 8px; font-size: 11px; line-height: 1.4; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: inherit; }
.mgn label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 7px 0; color: #c9cdd8; font-size: 13px; font-weight: 400; }
.mgn.mgn input[type=number], .mgn.mgn select { width: 128px; height: auto; padding: 6px 8px; margin: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 7px; font: inherit; outline: none; box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.mgn.mgn input[type=number]:focus, .mgn.mgn select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225, 29, 72, .2); }
.mgn input:disabled { opacity: .4; }
/* switch */
.mgn.mgn input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 34px; height: 19px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.mgn.mgn input[type=checkbox]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; }
.mgn.mgn input[type=checkbox]:checked { background: var(--accent); }
.mgn.mgn input[type=checkbox]:checked::after { transform: translateX(15px); }
.mgn input[type=checkbox]:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.mgn.mgn button, .mgn.mgn a.btn { font: inherit; font-size: 13px; line-height: 1.3; padding: 8px 12px; margin: 0; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card-2); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; text-transform: none; letter-spacing: 0; box-shadow: none; }
.mgn.mgn button:hover:not(:disabled), .mgn.mgn a.btn:hover { background: #283041; border-color: #47506a; color: var(--text); }
.mgn button:active:not(:disabled) { transform: translateY(1px); }
.mgn button:focus-visible, .mgn a.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.mgn.mgn .primary { background: linear-gradient(135deg, var(--accent), #be123c); border-color: transparent; font-weight: 600; color: #fff; }
.mgn.mgn .primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; }
.mgn.mgn button:disabled { opacity: .4; cursor: default; }
.mgn .row { display: flex; gap: 8px; flex-wrap: wrap; }
.mgn .row.grow > * { flex: 1; }

.mgn #files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mgn #files:empty::before { content: "No files yet"; color: var(--faint); }
.mgn #files li { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; padding: 8px 10px; margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.mgn #files small { color: var(--muted); }
.mgn.mgn .x { border: 0; background: none; color: var(--faint); padding: 0 4px; font-size: 16px; line-height: 1; }
.mgn.mgn .x:hover:not(:disabled) { color: var(--warn); background: none; }

.mgn progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); }
.mgn progress::-webkit-progress-bar { background: var(--line); }
.mgn progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), #7c3aed); }
.mgn progress::-moz-progress-bar { background: var(--accent); }
.mgn #status { color: var(--muted); white-space: pre-line; font-variant-numeric: tabular-nums; }
.mgn #status:empty { display: none; }
.mgn #warn { color: #fecdd3; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .45); border-radius: 8px; padding: 9px 11px; white-space: pre-line; font-weight: 500; }
.mgn #warn:empty { display: none; }
.mgn #labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mgn .warn-label { position: absolute; transform: translateY(calc(-100% - 3px)); color: #fff; background: var(--warn); font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }

/* plan / paywall */
.mgn #plan { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mgn #plan:empty { display: none; }
.mgn .plan-state { display: flex; align-items: center; gap: 8px; color: #c9cdd8; }
.mgn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.mgn .dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.mgn .plan-note { color: var(--muted); font-size: 12px; }
.mgn .plan-buy { display: flex; flex-direction: column; gap: 6px; }
.mgn .plan-buy .btn { justify-content: space-between; }
.mgn .plan-buy .btn b { font-weight: 600; }
.mgn .plan-buy .btn span { color: #fda4af; font-weight: 600; }
.mgn .plan-buy .primary span { color: #fff; }
.mgn .card.locked { border-color: rgba(225, 29, 72, .55); box-shadow: 0 0 0 3px rgba(225, 29, 72, .15); }

/* right-click shape menu */
.mgn { position: relative; }
.mgn .mgn-menu { position: absolute; z-index: 20; min-width: 230px; padding: 5px; background: rgba(24, 28, 37, .97); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .55); backdrop-filter: blur(8px); display: flex; flex-direction: column; }
.mgn .mgn-menu-head { padding: 6px 10px 7px; color: var(--muted); font-size: 11.5px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.mgn.mgn .mgn-menu button { width: 100%; justify-content: flex-start; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; }
.mgn.mgn .mgn-menu button:hover, .mgn.mgn .mgn-menu button:focus-visible { background: var(--card-2); outline: none; }
.mgn .mgn-menu .chk { width: 14px; color: var(--accent-2); font-weight: 700; flex: none; }
.mgn .mgn-menu .lbl { flex: 1; }
.mgn .mgn-menu .arr { color: var(--muted); }
.mgn .mgn-menu .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, .35); flex: none; }
.mgn .mgn-sub { position: relative; }
.mgn .mgn-submenu { display: none; top: -6px; left: calc(100% + 4px); }
.mgn .mgn-sub:hover > .mgn-submenu, .mgn .mgn-sub.open > .mgn-submenu, .mgn .mgn-sub:focus-within > .mgn-submenu { display: flex; }
.mgn .mgn-menu.flip .mgn-submenu { left: auto; right: calc(100% + 4px); }

.mgn aside::-webkit-scrollbar { width: 8px; } .mgn aside::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
@media (max-width: 760px) {
  .mgn, .mgn.alignfull { flex-direction: column; height: auto; }
  .mgn .mgn-view { height: 60vh; flex: none; }
  .mgn aside { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
}
