
.moulds-container { max-width:1280px; position: relative; width: 100%; height: 900px; display: flex; flex-direction: column; overflow: hidden;font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.moulds-container.no-scroll { overflow: hidden; }
:root {
    --bg: #0b0b0b;
    --panel: #0f1115;
    --panel-hover: #111521;
    --border: #1f2937;
    --border-accent: rgba(59,130,246,0.5);
    --text: #e5e7eb;
    --text-dark: #0f1115;
    --muted: #9ca3af;
    --primary: #2563eb;
    --primary-600: #2563eb;
}
/* Layout */
/* .section { padding: 16px; } */
.moulds-container .section { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.heading { font-size: .9rem; font-weight: 600; color: var(--text-dark); margin-bottom: 12px; }
.status { margin-top: 8px; font-size: 0.875rem; color: var(--muted); }

.moulds-scroll-region { flex: 1 1 auto; min-height: 0; overflow: auto; width: 100%; }

.moulds-sticky { position: sticky; top: 0; z-index: 5; padding: 16px 0 10px; background: none; border-bottom: 1px solid rgba(15,17,21,0.08); display: flex; flex-direction: column; gap: 12px; }
.moulds-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.moulds-toolbar-left { flex: 1 1 auto; min-width: 200px; }
.moulds-toolbar-right { flex: 0 0 auto; display: flex; justify-content: flex-end; min-width: 220px; }
.moulds-container.dark .moulds-sticky { background: #0b0b0b; border-bottom-color: rgba(229,231,235,0.08); }
.moulds-heading { margin: 0 0 14px 0; font-size: 2.1rem; line-height: 1.15; font-weight: 700; color: var(--text-dark); letter-spacing: .08em; text-transform: uppercase; }

.moulds-search { display: flex; align-items: center; border: 1px solid rgba(15,17,21,0.18); background: #fff; border-radius: 9999px; padding: 4px 14px; gap: 8px; }
.moulds-container.dark .moulds-search { background: #111827; border-color: rgba(229,231,235,0.2); color: #e5e7eb; }
.moulds-search-input { border: 0; background: transparent; color: inherit; min-width: 200px; font: 500 0.95rem/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; outline: none; }
.moulds-search-input::placeholder { color: rgba(15,17,21,0.5); }
.moulds-container.dark .moulds-search-input::placeholder { color: rgba(229,231,235,0.6); }

/* Category Tabs */
.moulds-tabs { display: flex; flex-wrap: wrap; gap: 20px; margin: 0; padding: 0; list-style: none; }
.moulds-tab { position: relative; background: none; border: none; padding: 8px 0; font: 600 1.05rem/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; color: var(--text-dark); cursor: pointer; letter-spacing: .08em; text-transform: uppercase; transition: color .2s ease, transform .2s ease; }
.moulds-tab:hover { color: var(--primary-600); }
.moulds-tab:hover::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--muted); border-radius: 2px; }
.moulds-tab.is-active { color: var(--primary); }
.moulds-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--primary); border-radius: 2px; }
.moulds-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Responsive grid: always at least 4 columns.
    Each column min 160px, max 1fr, but never fewer than 4 columns.
    Single items will not stretch to fill the whole row. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
@media (min-width: 0px) {
  .grid {
     grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .grid {
     grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .moulds-container {
      height: 600px;
  }
}
@media (max-width: 400px) {
  .grid {
     grid-template-columns: 1fr;
  }
  .moulds-container {
      height: 600px;
  }
}

/* Cards */
.card { cursor: pointer; border-radius: 10px; border: 1px solid var(--border); background: rgba(17, 24, 39, 0.6); transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; padding: 12px; }
.card:hover { background: #0f1117; border-color: var(--border-accent); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.thumb { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: #111827; }
.thumb-img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .3s ease; display: block; }
.card:hover .thumb-img { transform: scale(1.02); }
.filename { margin-top: 8px; font-size: 0.9375rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Overlay */
.overlay { position: absolute; inset: 0; z-index: 50; }
.overlay.is-hidden { display: none; }
.overlay-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.9); }
.overlay-inner { position: relative; width: 100%; height: 100%; }
.btn-close { position: absolute; top: 12px; left: 12px; z-index: 50; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; background: rgba(31,41,55,0.8); padding: 6px 12px; font-size: 12px; font-weight: 500; color: #f3f4f6; border: 1px solid rgba(255,255,255,0.1); cursor: pointer; }
.btn-close:hover { background: rgba(55,65,81,0.8); }
.overlay-filename { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 6px 12px; border-radius: 8px; background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.9); font-size: 0.9375rem; font-weight: 500; max-width: 80%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.viewer-host { position: relative; width: 100%; height: 100%; }

/* Body scroll lock */
html.no-scroll, body.no-scroll { overflow: hidden; }

/* Toolbar (3D viewer) */
.ov-toolbar { position: absolute; top: 12px; right: 12px; z-index: 50; background: rgba(0,0,0,0.7); color: #fff; padding: 12px; border-radius: 12px; width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); backdrop-filter: blur(2px); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.ov-toolbar.is-hidden { display: none; }
.ov-toolbar .tb-collapse { position: absolute; top: 8px; right: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.12); color: #fff; padding: 2px 6px; font-size: 12px; cursor: pointer; }
.ov-toolbar .tb-collapse:hover { background: rgba(255,255,255,0.2); }
.ov-toolbar .tb-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.ov-toolbar .tb-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; font-size: 12px; }
.ov-toolbar .tb-label { margin-right: 8px; }
.ov-toolbar .tb-input { height: 24px; width: 64px; border: 0; background: transparent; }
.ov-toolbar .tb-checkbox { width: 16px; height: 16px; margin-left: 8px; }
.ov-toolbar .tb-select { width: 130px; margin-left: 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: rgba(255,255,255,0.9); color: #0f172a; padding: 4px 8px; font-size: 12px; }
.ov-toolbar .tb-range-wrap { margin: 6px 0; font-size: 12px; }
.ov-toolbar .tb-range-head { display: flex; align-items: center; justify-content: space-between; }
.ov-toolbar .tb-range { width: 100%; }
.ov-toolbar .tb-button { width: 100%; border: 0; border-radius: 10px; padding: 8px 10px; background: var(--primary-600); color: #fff; font-size: 12px; cursor: pointer; }
.ov-toolbar .tb-hint { margin-top: 6px; font-size: 10px; opacity: 0.8; }

/* Toolbar expander (shown when toolbar is minimized) */
.ov-expander { position: absolute; top: 12px; right: 12px; z-index: 60; display: none; align-items: center; gap: 6px; border-radius: 9999px; border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.7); color: #fff; padding: 6px 10px; font-size: 12px; cursor: pointer; }
.ov-expander.is-visible { display: inline-flex; }
.ov-expander:hover { background: rgba(0,0,0,0.8); }