/* Estilos de la lista de materiales (materiales.html) y del visor 3D (visor-3d.html). */
/* Lista de materiales ---------------------------------------------------- */
main.ml-main { max-width: 1560px; }
.ml-main .page-head { max-width: 68ch; }
.ml-gate { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 1rem 1.25rem; }
.ml-gate p { color: var(--text-muted); margin: 0; flex: 1 1 260px; }
.ml-beta { display: inline-block; vertical-align: middle; margin-left: 0.5rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2em 0.6em; border-radius: 999px; border: 1px solid rgba(59,218,8,0.45); color: var(--accent); background: rgba(59,218,8,0.08); }

.ml-drop { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem; padding: 2.4rem 1.25rem 2rem; border: 2px dashed var(--surface-line); border-radius: var(--radius-md); background: radial-gradient(120% 100% at 50% 0%, rgba(59,218,8,0.07), transparent 60%), var(--surface); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.ml-drop:hover, .ml-drop:focus-visible { border-color: rgba(59,218,8,0.55); }
.ml-drop-ico { color: var(--accent); margin-bottom: 0.4rem; }
.ml-drop-t { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; margin: 0; }
.ml-drop-or { display: flex; align-items: center; gap: 0.6rem; color: var(--text-muted); margin: 0.2rem 0 0.4rem; }
.ml-drop-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0; max-width: 52ch; }
.ml-drop-status { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--accent); min-height: 1.2em; }
.ml-drop-status:empty { display: none; }
.ml-drop-status.is-error { color: var(--live-strong); }
.ml-drop.is-busy { opacity: 0.7; pointer-events: none; }
.ml-root.is-dragging .ml-drop { border-color: var(--accent); background: rgba(59,218,8,0.1); }
.ml-root.has-file .ml-drop { display: none; }
.ml-root.has-file.is-dragging .ml-drop { display: flex; position: fixed; inset: 1rem; z-index: 400; justify-content: center; background: rgba(7,9,6,0.92); }

.ml-file { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1rem; padding: 0.9rem 1.1rem; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); }
.ml-file-main { display: flex; align-items: center; gap: 0.8rem; min-width: 0; flex: 1 1 260px; }
.ml-file-main svg { color: var(--accent); flex-shrink: 0; }
.ml-file-main > div { min-width: 0; }
.ml-file-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ml-file-meta { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); overflow-wrap: anywhere; }
.ml-warn { margin-top: 0.8rem; padding: 0.7rem 1rem; border: 1px solid rgba(214,170,42,0.4); border-left: 4px solid #D6AA2A; border-radius: var(--radius-sm); background: rgba(214,170,42,0.07); }
.ml-warn p { margin: 0.15rem 0; font-size: 0.86rem; color: #E8D9A8; }

.ml-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0 1.4rem; }
.ml-stat { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.ml-stat-l { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.ml-stat strong { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.ml-stat small { color: var(--text-muted); font-size: 0.75rem; }
.ml-bar { display: block; height: 6px; border-radius: 99px; background: var(--bg-alt); overflow: hidden; margin-top: 0.35rem; }
.ml-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }
@media (max-width: 760px) { .ml-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Lista + vista 3D lado a lado */
.ml-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ml-split.is-v3closed { grid-template-columns: minmax(0, 1fr); }
.ml-main-col { min-width: 0; container-type: inline-size; }
.ml-side3d { position: sticky; top: calc(var(--nx-header-h, 64px) + 12px); max-height: calc(100vh - var(--nx-header-h, 64px) - 24px); overflow-y: auto; overscroll-behavior: contain; min-width: 0; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 0.8rem 0.9rem 0.9rem; }
.ml-side3d-h { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.ml-side3d-a { display: flex; gap: 0.5rem; flex-shrink: 0; }
.ml-side3d-h h3 { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 1.15rem; }
.ml-side3d-h h3 svg, .ml-v3show svg { color: var(--accent); }
.ml-side3d .m3d-stage { height: clamp(300px, calc(100vh - var(--nx-header-h, 64px) - 220px), 720px); }
.ml-side3d .ml-h3 { font-size: 1.05rem; margin-top: 1rem; }
.ml-tabbar { display: flex; align-items: flex-end; gap: 0.6rem; border-bottom: 1px solid var(--surface-line); margin-bottom: 1.1rem; }
.ml-tabbar .ml-tabs { flex: 1; min-width: 0; }
.ml-v3show { margin-bottom: 0.35rem; flex-shrink: 0; }
@media (max-width: 1060px) {
  .ml-split { grid-template-columns: minmax(0, 1fr); }
  .ml-side3d { position: static; max-height: none; order: -1; }
  .ml-side3d .m3d-stage { height: clamp(300px, 60vh, 560px); }
}
.ml-tabs { display: flex; gap: 0.3rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.ml-tabs::-webkit-scrollbar { display: none; }
.ml-tabs button { font: inherit; font-weight: 600; font-size: 0.95rem; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); padding: 0.6em 0.9em; cursor: pointer; white-space: nowrap; }
.ml-tabs button:hover { color: var(--text); }
.ml-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.ml-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--surface-line); border-radius: 99px; padding: 0.05em 0.5em; margin-left: 0.2rem; }

.ml-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.7rem; }
.ml-tools-sp { flex: 1; }
.ml-input { background: var(--bg-alt); border: 1px solid var(--surface-line); border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: 0.9rem; padding: 0.5em 0.7em; }
input.ml-input { flex: 1 1 220px; min-width: 0; }
.ml-input:focus { border-color: var(--accent); outline: none; }
.ml-switch { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text-muted); margin: 0 0 0.6rem; cursor: pointer; }
.ml-switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.ml-switch b { color: var(--accent); font-family: var(--font-mono); font-weight: 500; }
.ml-note, .ml-sub { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 0.9rem; max-width: 80ch; }
.ml-empty { color: var(--text-muted); padding: 1.4rem; background: var(--surface); border: 1px dashed var(--surface-line); border-radius: var(--radius-md); }
.ml-h3 { font-size: 1.25rem; margin: 1.6rem 0 0.3rem; }

.ml-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--surface-line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.ml-row { display: grid; grid-template-columns: auto 36px minmax(0, 1fr) auto minmax(0, 15rem); align-items: center; gap: 0.4rem 0.9rem; padding: 0.55rem 1rem; border-top: 1px solid var(--surface-line); }
.ml-row:first-child { border-top: 0; }
.ml-row.is-have { background: rgba(59,218,8,0.04); }
.ml-row.is-have .ml-name span, .ml-row.is-have .ml-qty strong { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(134,145,126,0.6); }
.ml-row.is-have .ml-ico { opacity: 0.45; }
.ml-check { position: relative; display: inline-flex; cursor: pointer; padding: 4px; margin: -4px; }
.ml-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ml-box { width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--surface-line); background: var(--bg-alt); display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s ease, border-color 0.12s ease; }
.ml-check:hover .ml-box { border-color: var(--accent); }
.ml-check input:focus-visible + .ml-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.ml-check input:checked + .ml-box { background: var(--accent); border-color: var(--accent); }
.ml-check input:checked + .ml-box::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid var(--accent-ink); border-bottom: 2.5px solid var(--accent-ink); transform: translateY(-1px) rotate(-45deg); }
.ml-ico { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.ml-ico-s { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.ml-ico-none { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--bg-alt); color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem; }
.ml-name { min-width: 0; display: flex; flex-direction: column; }
.ml-name span { font-weight: 600; overflow-wrap: anywhere; }
.ml-name code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); overflow-wrap: anywhere; }
.ml-qty { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.ml-qty strong { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ml-qty span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.ml-sh { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3rem 0.5rem; }
.ml-shchip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: #E3C9F2; background: rgba(150,90,190,0.13); border: 1px solid rgba(150,90,190,0.4); border-radius: 99px; padding: 0.15em 0.65em 0.15em 0.3em; white-space: nowrap; }
.ml-shchip img { width: 20px; height: 20px; image-rendering: pixelated; }
.ml-shbtn { font: inherit; font-size: 0.8rem; background: none; border: 0; padding: 0.15em 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(59,218,8,0.4); }
.ml-shbtn:hover { color: var(--accent-strong); }
.ml-shbtn.is-copied { color: var(--text); text-decoration: none; }
.ml-shprev { grid-column: 2 / -1; padding: 0.4rem 0 0.4rem; }
.ml-shprev p { margin: 0 0 0.45rem; font-size: 0.8rem; color: var(--text-muted); }
@container (max-width: 640px) {
  .ml-row { grid-template-columns: auto 32px minmax(0, 1fr) auto; padding: 0.6rem 0.8rem; }
  .ml-sh { grid-column: 3 / -1; justify-content: flex-start; }
  .ml-shprev { grid-column: 1 / -1; }
}

/* Inventario al estilo Minecraft */
.mc-inv { --cols: 9; --slot: 40px; display: grid; grid-template-columns: repeat(var(--cols), var(--slot)); gap: 0; width: max-content; max-width: 100%; padding: 6px; background: #C6C6C6; border-radius: 4px; box-shadow: inset 2px 2px 0 #FFFFFF, inset -2px -2px 0 #555555; }
.mc-inv--s { --slot: 32px; }
.mc-slot { position: relative; width: var(--slot); height: var(--slot); background: #8B8B8B; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #FFFFFF; display: flex; align-items: center; justify-content: center; }
.mc-slot img { width: 78%; height: 78%; object-fit: contain; image-rendering: pixelated; }
.mc-noicon { font-family: var(--font-mono); font-size: 0.6rem; color: #222; }
.mc-n { position: absolute; right: 3px; bottom: 0; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: #FFF; text-shadow: 1.5px 1.5px 0 #3F3F3F; line-height: 1.2; }
.mc-slot.has-nested::after { content: ""; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #9A5CC6; box-shadow: 0 0 0 1px #FFF; }
@media (max-width: 480px) { .mc-inv { --slot: calc((100vw - 4.5rem) / 9); } .mc-inv--s { --slot: calc((100vw - 6rem) / 9); } .mc-n { font-size: 0.65rem; } }

.ml-chips { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ml-chip { display: inline-flex; align-items: center; gap: 0.45rem; background: var(--surface); border: 1px solid var(--surface-line); border-radius: 99px; padding: 0.25em 0.75em 0.25em 0.35em; font-size: 0.86rem; }
.ml-chip b { font-family: var(--font-mono); font-weight: 600; color: var(--accent); }
.ml-conts, .ml-signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 410px), 1fr)); align-items: start; gap: 0.9rem; margin-top: 0.8rem; }
.ml-signs { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ml-cont, .ml-sign { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.ml-cont-h { display: flex; align-items: center; gap: 0.7rem; }
.ml-cont-h > div { flex: 1; min-width: 0; }
.ml-cont-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ml-cont-label { color: var(--accent); font-weight: 500; }
.ml-cont-pos { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.ml-same { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent-ink); background: var(--accent); border-radius: 99px; padding: 0.15em 0.6em; font-weight: 600; }
.ml-cont .ml-shbtn { align-self: flex-start; }
.ml-mobs { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ml-mob .ml-ico { width: 36px; height: 36px; }
.ml-chips--s { margin: 0; align-items: center; }
.ml-chips--s .ml-sub { margin: 0; list-style: none; }
.ml-chips--s .ml-chip { font-size: 0.8rem; }
.ml-nested p { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.ml-poslist { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.ml-poslist li { background: var(--bg-alt); border: 1px solid var(--surface-line); border-radius: 4px; padding: 0.1em 0.45em; }

/* Carteles */
.ml-side { display: flex; flex-direction: column; gap: 0.4rem; }
.ml-side-t { margin: 0; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.ml-board { --ink: #1A1A1A; display: flex; flex-direction: column; padding: 0.5rem 0.4rem; border-radius: 4px; background: linear-gradient(180deg, #B8945F, #A07F4D); box-shadow: inset 0 0 0 2px #6E5530, inset 0 -3px 0 rgba(0,0,0,0.18); }
.ml-board.is-hanging { background: linear-gradient(180deg, #A9865A, #8E6E44); }
.ml-line { font: 600 0.95rem/1.35 var(--font-mono); color: var(--ink); background: none; border: 0; border-radius: 3px; padding: 0.12em 0.3em; text-align: center; cursor: pointer; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; transition: background 0.12s ease; }
.ml-line:not(:disabled):hover { background: rgba(255,255,255,0.22); }
.ml-line:disabled { cursor: default; }
.ml-line.is-copied { background: rgba(59,218,8,0.45); }
.ml-board.is-glow .ml-line { text-shadow: 0 0 6px rgba(255,255,255,0.65); }
.ml-board[data-dye="white"] { --ink: #F4F4F4; } .ml-board[data-dye="orange"] { --ink: #C3600A; } .ml-board[data-dye="magenta"] { --ink: #9C2B95; }
.ml-board[data-dye="light_blue"] { --ink: #1F6F9C; } .ml-board[data-dye="yellow"] { --ink: #8C7400; } .ml-board[data-dye="lime"] { --ink: #3E7B0B; }
.ml-board[data-dye="pink"] { --ink: #B4486D; } .ml-board[data-dye="gray"] { --ink: #3A3D40; } .ml-board[data-dye="light_gray"] { --ink: #5E5E58; }
.ml-board[data-dye="cyan"] { --ink: #0F6670; } .ml-board[data-dye="purple"] { --ink: #5A1E8C; } .ml-board[data-dye="blue"] { --ink: #26318A; }
.ml-board[data-dye="brown"] { --ink: #4E2E14; } .ml-board[data-dye="green"] { --ink: #3B5112; } .ml-board[data-dye="red"] { --ink: #8E1F1A; }
.ml-side-f { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ml-sign-tags { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; }
/* Vista 3D */
.m3d { display: flex; flex-direction: column; gap: 0.7rem; }
/* Barra de capas: modos con dibujo de capas apiladas (verde = se ven) y eje con su dibujo. */
.m3d-bar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.6rem; }
.m3d-modes, .m3d-axes { display: flex; gap: 0.3rem; padding: 0.3rem; background: var(--surface); border: 1px solid var(--surface-line); border-radius: 12px; }
.m3d-axes[hidden] { display: none; }
.m3d-modes button, .m3d-axes button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; min-width: 4.6rem; padding: 0.45rem 0.6rem; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text-muted); font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.15; cursor: pointer; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.m3d-modes button:hover, .m3d-axes button:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.m3d-modes button[aria-checked="true"], .m3d-axes button[aria-checked="true"] { color: var(--text); background: rgba(59,218,8,0.12); border-color: rgba(59,218,8,0.55); }
.m3d-ico rect.on { fill: var(--accent); }
.m3d-ico rect.off { fill: currentColor; opacity: 0.22; }
.m3d-modes button:not([aria-checked="true"]) .m3d-ico rect.on { fill: currentColor; opacity: 0.85; }
.m3d-axico rect, .m3d-axico path { fill: currentColor; stroke: currentColor; }
.m3d-axes button[aria-checked="true"] .m3d-axico rect, .m3d-axes button[aria-checked="true"] .m3d-axico path { fill: var(--accent); stroke: var(--accent); }
.m3d-recenter { position: absolute; bottom: 0.6rem; right: 0.6rem; z-index: 3; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.7rem; border: 1px solid var(--surface-line); border-radius: 999px; background: rgba(10,14,9,0.85); color: var(--text); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.m3d-recenter:hover { border-color: var(--accent); color: var(--accent); }

/* Encima del render: «Construir capa a capa» (modo Todo) y el control grande de la capa. */
.m3d-cta { position: absolute; left: 50%; top: 0.9rem; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.75rem 1.25rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink, #06210A); font: inherit; font-weight: 700; font-size: 0.98rem; cursor: pointer; box-shadow: 0 10px 28px rgba(0,0,0,0.5), 0 0 0 4px rgba(59,218,8,0.18); white-space: nowrap; animation: m3d-pulse 2.4s ease-in-out 3; }
.m3d-cta:hover { background: var(--accent-strong); }
.m3d-cta[hidden] { display: none; }
.m3d-cta .m3d-ico rect.on { fill: currentColor; }
.m3d-cta .m3d-ico rect.off { fill: currentColor; opacity: 0.3; }
@keyframes m3d-pulse { 0%, 100% { box-shadow: 0 10px 28px rgba(0,0,0,0.5), 0 0 0 4px rgba(59,218,8,0.18); } 50% { box-shadow: 0 10px 28px rgba(0,0,0,0.5), 0 0 0 10px rgba(59,218,8,0.06); } }
@media (prefers-reduced-motion: reduce) { .m3d-cta { animation: none; } }
.m3d-hud { position: absolute; left: 50%; top: 0.7rem; transform: translateX(-50%); z-index: 3; width: min(560px, calc(100% - 1.2rem)); padding: 0.5rem; background: rgba(10,14,9,0.9); border: 1px solid rgba(59,218,8,0.5); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 4px rgba(59,218,8,0.12); backdrop-filter: blur(6px); animation: m3d-hud-in 1.6s ease-out 1; }
@keyframes m3d-hud-in { 0% { box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 0 rgba(59,218,8,0.55); } 60% { box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 14px rgba(59,218,8,0); } 100% { box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 4px rgba(59,218,8,0.12); } }
@media (prefers-reduced-motion: reduce) { .m3d-hud { animation: none; } }
.m3d-hud[hidden] { display: none; }
/* Movible: asa a la izquierda; una vez colocado, la posición la ponen left/top en px. */
.m3d-hud { display: flex; align-items: stretch; gap: 0.35rem; touch-action: none; cursor: grab; }
.m3d-hud.is-placed { transform: none; }
.m3d-hud.is-dragging { cursor: grabbing; animation: none; box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 0 4px rgba(59,218,8,0.3); }
.m3d-hud button, .m3d-hud input, .m3d-hud label { cursor: pointer; }
.m3d-hud input[type=number] { cursor: text; }
.m3d-hudbody { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.m3d-grip { flex: 0 0 auto; display: grid; place-items: center; width: 20px; margin: -0.5rem 0 -0.5rem -0.5rem; padding-left: 0.2rem; border-radius: 13px 0 0 13px; color: var(--text-muted); cursor: grab; }
.m3d-grip:hover, .m3d-hud.is-dragging .m3d-grip { color: var(--accent); background: rgba(59,218,8,0.08); }
.m3d-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.m3d-layer { display: flex; align-items: center; gap: 0.5rem; }
.m3d-layer[hidden], .m3d-range[hidden] { display: none; }
.m3d-lmid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0.3rem; text-align: center; }
.m3d-lmid output { font-size: 0.9rem; color: var(--text-muted); white-space: nowrap; }
.m3d-lmid output strong { font-size: 1.45rem; color: var(--text); font-family: var(--font-mono); }
.m3d-layer input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.m3d-step { min-width: 48px; height: 48px; padding: 0 0.85rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; border-radius: 12px; border: 1px solid var(--surface-line); background: var(--bg-alt); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.m3d-step[data-m3d=inc] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #06210A); }
.m3d-step[data-m3d=inc]:hover:not(:disabled) { background: var(--accent-strong); color: var(--accent-ink, #06210A); }
.m3d-step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.m3d-step:disabled { opacity: 0.35; cursor: default; }
.m3d-range { display: flex; gap: 0.6rem; justify-content: center; }
.m3d-range label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.m3d-range input { width: 5.5rem; background: var(--bg-alt); border: 1px solid var(--surface-line); border-radius: var(--radius-sm); color: var(--text); font: inherit; font-family: var(--font-mono); padding: 0.5rem 0.6rem; }
@media (max-width: 640px) {
  .m3d-modes { flex: 1 1 100%; display: grid; grid-template-columns: repeat(5, 1fr); }
  .m3d-modes button { min-width: 0; padding: 0.45rem 0.15rem; font-size: 0.7rem; }
  .m3d-axes { flex: 1 1 auto; }
  .m3d-axes button { flex: 1; min-width: 0; flex-direction: row; font-size: 0.72rem; }
  .m3d-recenter span { display: none; }
  .m3d-recenter { padding: 0.5rem; }

  .m3d-step { min-width: 46px; height: 46px; padding: 0; } .m3d-step span { display: none; }
  .m3d-cta { font-size: 0.92rem; padding: 0.7rem 1.1rem; }
}

.m3d-stage { position: relative; height: clamp(340px, 68vh, 680px); border: 1px solid var(--surface-line); border-radius: var(--radius-md); overflow: hidden; background: #0B0F0A; touch-action: none; }
.m3d-canvas { image-rendering: pixelated; }
.m3d-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.m3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.m3d-canvas:active { cursor: grabbing; }
.m3d-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1.5rem; text-align: center; line-height: 1.5; color: var(--text-muted); }
.ml-v3 > .m3d-loading { position: static; padding: 3rem 0; }
.m3d-tip { position: absolute; pointer-events: none; background: rgba(7,9,6,0.92); border: 1px solid var(--surface-line); border-radius: var(--radius-sm); padding: 0.3em 0.6em; font-size: 0.8rem; white-space: nowrap; }
.m3d-hint { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
@media (max-width: 640px) { .m3d-hint { display: none; } }
.ml-sign-tags span { font-size: 0.72rem; color: var(--text-muted); border: 1px solid var(--surface-line); border-radius: 99px; padding: 0.05em 0.55em; }


/* Botones que abren la otra herramienta en otra pestaña */
.ml-file-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ml-go { gap: 0.4em; }
.ml-go[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.m3d-overlay { position: absolute; left: 0.6rem; top: 0.6rem; z-index: 2; display: flex; gap: 0.4rem; pointer-events: none; }
.m3d-overlay > * { pointer-events: auto; }
.m3d-ov-btn { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 0.35em 0.85em; box-shadow: 0 6px 16px -6px rgba(0,0,0,0.7); }
.m3d-ov-btn:hover { background: var(--accent-strong); }
.m3d-ov-btn[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }

/* Visor 3D (visor-3d.html): vista grande + materiales de las capas que se ven */
.vw-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 1.1rem; align-items: start; margin-top: 1rem; }
.vw-3d { min-width: 0; }
.vw-3d .m3d-stage { height: clamp(420px, calc(100vh - var(--nx-header-h, 64px) - 170px), 920px); }
.vw-side { position: sticky; top: calc(var(--nx-header-h, 64px) + 12px); max-height: calc(100vh - var(--nx-header-h, 64px) - 24px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 0.9rem 0.9rem 0.6rem; }
.vw-side-h h2 { font-size: 1.3rem; margin: 0 0 0.15rem; }
.vw-side-h p { margin: 0 0 0.7rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.vw-list { list-style: none; margin: 0; padding: 0; }
.vw-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; padding: 0.4rem 0.1rem; border-top: 1px solid var(--surface-line); }
.vw-row:first-child { border-top: 0; }
.vw-name { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.vw-qty { display: flex; flex-direction: column; align-items: flex-end; }
.vw-qty strong { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.vw-qty small { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
@media (max-width: 1000px) {
  .vw-split { grid-template-columns: minmax(0, 1fr); }
  .vw-side { position: static; max-height: none; }
  .vw-3d .m3d-stage { height: clamp(320px, 62vh, 600px); }
}
