/* 3D tools (mesh & texture): site/three3d/mesh-ui.js and mesh-texui.js. Area rules only; tokens live in style.css. */
.m3 { gap: 16px; }
.m3-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; align-items: end; }
.m3-opts:empty, .m3-opts[hidden] { display: none; }
.m3-opts [hidden] { display: none; }
.m3-opts .check { padding-bottom: 10px; }
.m3-opts .m3-wide { grid-column: 1 / -1; }
.m3-range span { display: flex; justify-content: space-between; gap: 8px; }
.m3-range output { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.m3-range input { width: 100%; }
.m3-status:empty { display: none; }
.m3-out { display: grid; gap: 14px; min-width: 0; }
.m3-out:empty { display: none; }

/* dropped models */
.m3-files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.m3-files:empty { display: none; }
.m3-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; }
.m3-files b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m3-files .note { font-variant-numeric: tabular-nums; }
.m3-x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.m3-x:hover { background: var(--line); }

/* before → after */
.m3-cmp td, .m3-cmp th { white-space: nowrap; }
.m3-chg { color: var(--local); font-weight: 600; }
.m3-total td { font-weight: 700; }
.m3-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.m3-facts > div { padding: 8px 12px; border-radius: 10px; background: var(--soft); min-width: 0; }
.m3-facts dt { font-size: 13px; color: var(--muted); }
.m3-facts dd { margin: 0; font: 600 16px/1.3 var(--body); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* preview: one canvas, one or two panes that turn together */
.m3-viewbox { display: grid; gap: 8px; }
.m3-view { position: relative; height: min(56vh, 460px); border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 50% 40%, var(--panel), var(--soft)); border: 1px solid var(--line); touch-action: none; }
.m3-view[hidden] { display: none; }
.m3-view .note { padding: 16px; }
.m3-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.m3-canvas:active { cursor: grabbing; }
.m3-view.m3-two::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid var(--line); pointer-events: none; }
.m3-tag { position: absolute; top: 10px; padding: 3px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; pointer-events: none; }
.m3-tag0 { left: 10px; }
.m3-tag1 { left: calc(50% + 10px); }
.m3-viewbox > .check[hidden] { display: none; }
.m3-viewbox:has(.m3-view[hidden]) > .check { display: none; }

/* validator */
.m3-verdict { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.m3-verdict b { font: 700 18px/1.3 var(--body); }
.m3-verdict span { font-size: 14px; color: var(--muted); }
.m3-verdict.ok { border-color: color-mix(in srgb, var(--local) 50%, var(--line)); background: color-mix(in srgb, var(--local) 10%, var(--panel)); }
.m3-verdict.warn { border-color: color-mix(in srgb, #C99400 50%, var(--line)); background: color-mix(in srgb, var(--yellow) 14%, var(--panel)); }
.m3-verdict.bad { border-color: color-mix(in srgb, #C0362C 50%, var(--line)); background: color-mix(in srgb, #C0362C 9%, var(--panel)); }
.m3-issues { max-height: 420px; }
.m3-issues tr.m3-error td:first-child { color: #C0362C; font-weight: 600; }
.m3-issues tr.m3-warning td:first-child { color: #8A6400; font-weight: 600; }
:root[data-theme="dark"] .m3-issues tr.m3-warning td:first-child { color: var(--yellow); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .m3-issues tr.m3-warning td:first-child { color: var(--yellow); } }

/* texture tools */
.m3-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.m3-fig { margin: 0; display: grid; gap: 8px; align-content: start; min-width: 0; }
.m3-pic { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center;
  background: conic-gradient(#d9dedc 25%, #fff 0 50%, #d9dedc 0 75%, #fff 0) 0 0 / 16px 16px; }
/* small textures are shown larger, never stretched (object-fit keeps the shape) */
.m3-pic canvas { width: 100%; height: auto; max-height: 60vh; object-fit: contain; display: block; }
.m3-fig figcaption { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; }
.m3-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.m3-same { color: var(--muted); }
table.t td.mono { white-space: nowrap; }

@media (max-width: 600px) {
  .m3-view { height: 300px; }
  .m3-files li { grid-template-columns: minmax(0, 1fr) auto; }
  .m3-files li .note { grid-row: 2; }
  .m3-files .m3-x { grid-row: 1 / span 2; grid-column: 2; }
}
