:root {
  color-scheme: light;
  --ink: #102033;
  --muted: #5c6f86;
  --faint: #8ba0b6;
  --paper: #f5f9ff;
  --panel: #ffffff;
  --line: #d9e5f2;
  --line-strong: #bed0e5;
  --teal: #2563eb;
  --teal-dark: #1e3a8a;
  --teal-soft: #e8f1ff;
  --amber: #0ea5e9;
  --green: #0f75bc;
  --graphite: #23334a;
  --shadow: 0 18px 48px rgba(28, 52, 84, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #eaf3ff;
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.app-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  background: #eaf3ff;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 64px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(28, 52, 84, 0.08);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.top-brand strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #102033;
  font-size: 0.98rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-nav {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  min-width: 0;
  padding: 4px;
  border: 1px solid #d7e5f5;
  border-radius: 8px;
  background: #f5f9ff;
}

.top-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #36506b;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
  white-space: nowrap;
}

.top-nav-button svg {
  width: 18px;
  height: 18px;
}

.top-nav-button:hover {
  background: #eaf2ff;
  color: #153f8f;
  transform: translateY(-1px);
}

.top-nav-button.active {
  border-color: rgba(37, 99, 235, 0.22);
  background: #fff;
  color: var(--teal-dark);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.nav-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 900;
}

.app-view {
  min-height: 0;
}

.app-view[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  height: 100%;
  background: #eaf3ff;
}

.library-view {
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.96), rgba(234, 243, 255, 0.96)),
    #f4f8ff;
}

.library-shell {
  display: grid;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 2px 2px;
}

.library-count {
  max-width: 142px;
}

.library-workbench {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.library-upload-bar,
.library-materials-panel {
  display: grid;
  min-width: 0;
}

.library-drop-zone {
  grid-template-columns: 30px 48px minmax(0, 1fr) 86px;
  min-height: 78px;
  border-color: #bcd1ea;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.96)),
    #fff;
  box-shadow: 0 10px 22px rgba(28, 52, 84, 0.06);
}

.library-drop-zone:hover,
.library-drop-zone.dragging {
  border-color: rgba(37, 99, 235, 0.62);
  background: #fff;
}

.library-drop-zone .drop-action {
  justify-self: end;
  width: 72px;
  text-align: center;
}

.library-materials-panel {
  gap: 10px;
}

.library-table-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.library-table-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.library-table-header > div:first-child span,
#library-selected-count {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid #d7e1e4;
  border-radius: 999px;
  background: #edf5ff;
  color: #586775;
  font-size: 0.74rem;
  font-weight: 800;
}

.library-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.library-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d7e5f5;
  border-radius: 8px;
  background: #fff;
  color: #36506b;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.library-select-all:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.library-select-all input,
.library-row-select {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.library-delete-selected-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    opacity 150ms ease;
  white-space: nowrap;
}

.library-delete-selected-button svg {
  width: 16px;
  height: 16px;
}

.library-delete-selected-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  transform: translateY(-1px);
}

.library-table-shell {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid #d6e2f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(28, 52, 84, 0.08);
}

.library-material-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.library-material-table th,
.library-material-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e4edf6;
  color: #26384c;
  font-size: 0.8rem;
  text-align: left;
  vertical-align: middle;
}

.library-material-table th {
  background: #f2f7ff;
  color: #39526f;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.library-material-table th:nth-child(1),
.library-material-table td:nth-child(1) {
  width: 72px;
}

.library-material-table th:nth-child(2),
.library-material-table td:nth-child(2) {
  width: 84px;
}

.library-material-table th:nth-child(3),
.library-material-table td:nth-child(3) {
  width: 30%;
}

.library-material-table tbody tr:last-child td {
  border-bottom: 0;
}

.library-material-row:hover td {
  background: #f7fbff;
}

.library-material-row.selected td {
  background: #eef6ff;
}

.library-select-cell {
  text-align: center;
}

.library-select-heading {
  text-align: center;
}

.library-preview-cell {
  width: 84px;
}

.library-table-thumb {
  display: block;
  width: 50px;
  height: 50px;
  border: 1px solid #d7e1e4;
  border-radius: 6px;
  background-color: #eaf2ff;
  background-position: center;
  background-size: cover;
}

.library-name-cell {
  min-width: 0;
}

.library-name-cell small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-name-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.library-name-input {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #d5e2f0;
  border-radius: 8px;
  background: #fff;
  color: #152234;
  font-size: 0.84rem;
  font-weight: 850;
}

.library-name-input:hover {
  border-color: #b9cde5;
  background: #f9fcff;
}

.library-name-input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  background: #fff;
}

.library-name-input.unsaved {
  border-color: #60a5fa;
  background: #f8fbff;
}

.library-name-input.invalid {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.library-save-name-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 900;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    opacity 150ms ease;
}

.library-save-name-button svg {
  width: 15px;
  height: 15px;
}

.library-save-name-button:not(:disabled):hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  transform: translateY(-1px);
}

.library-name-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.library-empty-row td {
  padding: 18px;
}

.library-empty-row .empty-state {
  min-height: 240px;
  border: 1px dashed #cbd7db;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 255, 0.98)),
    var(--paper);
}

.control-panel::-webkit-scrollbar,
.assignment-list::-webkit-scrollbar {
  width: 9px;
}

.control-panel::-webkit-scrollbar-thumb,
.assignment-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #c2cdd1;
  background-clip: content-box;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 52px;
  height: 52px;
  padding: 5px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: #101820;
  font-size: 1.42rem;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: #172028;
  font-size: 0.96rem;
  letter-spacing: 0;
}

.status-pill {
  position: relative;
  flex: 0 0 auto;
  max-width: 118px;
  padding: 7px 11px 7px 24px;
  overflow: hidden;
  border: 1px solid #b7d3f5;
  border-radius: 999px;
  background: #eaf3ff;
  color: #1e4fa3;
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill::before {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  content: "";
  transform: translateY(-50%);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.assets-section {
  padding-top: 20px;
}

.section-heading,
.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading span {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid #d7e1e4;
  border-radius: 999px;
  background: #edf5ff;
  color: #586775;
  font-size: 0.74rem;
  font-weight: 800;
}

.asset-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 10px;
  align-items: stretch;
}

.material-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 249, 0.96)),
    #fff;
  box-shadow: 0 10px 28px rgba(31, 49, 58, 0.06);
}

.material-card:has(.drop-zone.loaded) {
  border-color: rgba(37, 99, 235, 0.58);
  background:
    linear-gradient(180deg, rgba(241, 247, 255, 0.94), rgba(255, 255, 255, 0.98)),
    #fff;
}

.material-card .asset-control {
  gap: 12px;
}

.material-card .drop-zone {
  min-height: 76px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.material-card .drop-zone.loaded {
  border-color: transparent;
  background: transparent;
}

.material-card .drop-zone:hover,
.material-card .drop-zone.dragging {
  border-color: rgba(37, 99, 235, 0.46);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 30px 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: #202a32;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.drop-zone::before {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.09), rgba(14, 165, 233, 0.06));
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.drop-zone.compact {
  min-height: 72px;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: rgba(37, 99, 235, 0.74);
  box-shadow: 0 14px 32px rgba(31, 49, 58, 0.09);
  transform: translateY(-1px);
}

.drop-zone:hover::before,
.drop-zone.dragging::before {
  opacity: 1;
}

.drop-zone.loaded {
  border-color: rgba(37, 99, 235, 0.58);
  background: #f1f7ff;
}

.drop-zone.unsupported {
  cursor: not-allowed;
  opacity: 0.58;
}

.drop-zone.loaded .step-badge {
  border-color: rgba(37, 99, 235, 0.25);
  background: var(--green);
  color: #fff;
}

.step-badge {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #d5dee1;
  border-radius: 999px;
  background: #edf5ff;
  color: #687682;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
}

.drop-icon,
.swatch {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #d8e1e3;
  border-radius: 8px;
  background: #eaf2ff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
}

.drop-icon svg,
.empty-state svg,
.viewer-empty svg {
  width: 23px;
  height: 23px;
  color: var(--teal-dark);
}

.drop-copy {
  display: block;
  min-width: 0;
}

.drop-copy strong,
.drop-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-copy strong {
  margin-bottom: 4px;
  color: #172028;
  font-size: 0.94rem;
  font-weight: 850;
}

.drop-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.drop-action {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #d6e0e3;
  border-radius: 8px;
  background: #ffffff;
  color: #39505c;
  font-size: 0.73rem;
  font-weight: 900;
}

.drop-zone.loaded .drop-action {
  border-color: rgba(37, 99, 235, 0.24);
  background: #e8f1ff;
  color: #1e4fa3;
}

.clear-asset-button {
  min-height: 72px;
  border: 1px solid #d5e0e3;
  border-radius: 8px;
  background: #fff;
  color: #53626e;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    opacity 150ms ease,
    transform 150ms ease;
}

.clear-asset-button:hover {
  border-color: #bdcbd0;
  background: #f6faff;
  color: #26363e;
  transform: translateY(-1px);
}

.clear-asset-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.material-settings {
  border: 1px solid #dce5e7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.material-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  color: #334650;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 850;
  list-style: none;
}

.material-settings summary::-webkit-details-marker {
  display: none;
}

.material-settings summary svg {
  width: 17px;
  height: 17px;
  color: #61717b;
  transition: transform 150ms ease;
}

.material-settings[open] summary svg {
  transform: rotate(180deg);
}

.material-settings-body {
  padding: 0 14px 14px;
}

.material-options-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}

.material-options-list::-webkit-scrollbar {
  width: 9px;
}

.material-options-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #c2cdd1;
  background-clip: content-box;
}

.material-options-list .empty-state {
  grid-column: 1 / -1;
}

.material-option-card {
  display: grid;
  position: relative;
  gap: 0;
  min-width: 0;
  padding: 5px;
  border: 1px solid #dce5e7;
  border-radius: 8px;
  background: #fff;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.wood-option-card {
  aspect-ratio: 1;
}

.static-option-card,
.wood-option-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.material-option-swatch,
.wood-thumb {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #d7e1e4;
  border-radius: 6px;
  background-color: #eaf2ff;
}

.wood-thumb {
  background-position: center;
  background-size: cover;
}

.none-swatch {
  background:
    linear-gradient(45deg, #d7dedf 25%, transparent 25%),
    linear-gradient(-45deg, #d7dedf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7dedf 75%),
    linear-gradient(-45deg, transparent 75%, #d7dedf 75%),
    #f4f7f7;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.material-option-copy {
  display: block;
  min-width: 0;
}

.material-option-copy strong,
.material-option-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-option-copy strong {
  color: #1b252d;
  font-size: 0.88rem;
  font-weight: 850;
}

.material-option-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.compact-material-settings {
  background: #f5f9ff;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.swatch {
  background:
    linear-gradient(45deg, #d7dedf 25%, transparent 25%),
    linear-gradient(-45deg, #d7dedf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7dedf 75%),
    linear-gradient(-45deg, transparent 75%, #d7dedf 75%),
    #f4f7f7;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.55fr) minmax(0, 1.45fr);
  column-gap: 12px;
  row-gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px;
  border: 1px solid #dce5e7;
  border-radius: 8px;
  background: #fff;
}

.assignment-row > * {
  min-width: 0;
}

.mesh-name {
  min-width: 0;
}

.part-name-input {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-name-input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #1b252d;
  font-size: 0.86rem;
  font-weight: 850;
}

.part-name-input:hover {
  border-color: #d8e1e3;
  background: #f6faff;
}

.part-name-input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  background: #fff;
}

.assignment-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.role-select {
  width: 100%;
  min-width: 0;
  padding: 9px 28px 9px 10px;
  border: 1px solid #cdd8dc;
  border-radius: 8px;
  background: #f6faff;
  color: #1f2a31;
  font-size: 0.82rem;
  font-weight: 800;
}

.direction-toggle {
  display: grid;
  grid-template-columns: repeat(2, 36px);
  gap: 6px;
}

.part-pattern-label {
  padding-left: 6px;
  color: #344650;
  font-size: 0.84rem;
  font-weight: 850;
}

.part-pattern-label.disabled {
  color: #a8b1b8;
}

.pattern-range {
  align-self: center;
  min-width: 0;
}

.direction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid #cdd8dc;
  border-radius: 8px;
  background: #fff;
  color: #31424b;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.direction-button svg {
  width: 18px;
  height: 18px;
}

.direction-button:hover {
  border-color: #b7c7cc;
  background: #eef6ff;
  transform: translateY(-1px);
}

.direction-button.active {
  border-color: rgba(37, 99, 235, 0.42);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px dashed #cbd7db;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(14, 165, 233, 0.06)),
    #f5f9ff;
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  grid-column: 1 / -1;
  min-height: 96px;
}

.empty-state p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 750;
}

.control-stack {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dce5e7;
  border-radius: 8px;
  background: #fff;
}

.control-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.control-row label {
  color: #344650;
  font-size: 0.84rem;
  font-weight: 850;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  accent-color: #95a2aa;
}

.control-row:has(input[type="range"]:disabled) label {
  color: #788690;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.icon-button,
.toolbar-tool-button,
.tool-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    opacity 150ms ease,
    box-shadow 150ms ease;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  border: 1px solid #d2dddf;
  background: #fff;
  color: #26363e;
}

.icon-button svg,
.toolbar-tool-button svg,
.tool-button svg,
.primary-button svg,
.secondary-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover,
.toolbar-tool-button:hover,
.tool-button:hover,
.secondary-button:hover {
  border-color: #b7c7cc;
  background: #eef6ff;
}

.tool-button,
.toolbar-tool-button,
.secondary-button {
  border: 1px solid #cdd9dc;
  background: #fff;
  color: #1f2c33;
  font-weight: 900;
}

.toolbar-tool-button.active {
  border-color: rgba(37, 99, 235, 0.42);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.toolbar-tool-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.primary-button,
.secondary-button {
  width: 100%;
}

.primary-button {
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.secondary-button:hover,
.tool-button:hover,
.toolbar-tool-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.export-section {
  margin-top: auto;
}

.png-export-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dce5e7;
  border-radius: 8px;
  background: #fff;
}

.png-background-slider {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 42px;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(37, 99, 235, 0.62);
  border-radius: 8px;
  background: #fff;
}

.png-slider-thumb {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: 50%;
  height: 100%;
  border-radius: 5px 0 0 5px;
  background: var(--teal);
  transition: transform 180ms ease;
}

.png-background-slider.transparent-selected .png-slider-thumb {
  border-radius: 0 5px 5px 0;
  transform: translateX(100%);
}

.png-slider-option {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid rgba(37, 99, 235, 0.62);
  background: transparent;
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  transition:
    color 150ms ease,
    opacity 150ms ease;
}

.png-slider-option:last-child {
  border-right: 0;
}

.png-slider-option.active {
  color: #fff;
}

.png-slider-option:hover {
  color: #23323a;
}

.png-slider-option.active:hover {
  color: #fff;
}

.viewer-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.viewer-toolbar {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid rgba(188, 200, 205, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.viewer-kicker,
.viewer-toolbar strong,
.viewer-toolbar span:not(.viewer-kicker) {
  display: block;
  max-width: min(600px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-kicker {
  margin-bottom: 3px;
  color: var(--teal-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.viewer-toolbar strong {
  margin-bottom: 2px;
  color: #121a21;
  font-size: 1rem;
  font-weight: 900;
}

.viewer-toolbar span:not(.viewer-kicker) {
  color: #667580;
  font-size: 0.8rem;
  font-weight: 650;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#scene-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  outline: none;
}

.export-freeze-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: #fff;
  pointer-events: none;
}

.viewer-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  color: #586774;
  text-align: center;
  pointer-events: none;
}

.viewer-empty svg {
  width: 54px;
  height: 54px;
  padding: 13px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--teal-dark);
  box-shadow: 0 16px 40px rgba(31, 49, 58, 0.12);
}

.viewer-empty p {
  max-width: 320px;
  margin: 0;
  color: #40505b;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.45;
}

.viewer-empty.hidden {
  display: none;
}

.toast {
  position: fixed;
  z-index: 4;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(23, 32, 40, 0.9);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-frame {
    height: auto;
    min-height: 100vh;
  }

  .top-bar {
    position: sticky;
    z-index: 10;
    top: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav-button {
    flex: 1 1 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 118px);
  }

  .control-panel {
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .viewer-shell {
    min-height: 64vh;
  }

  .viewer-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .viewer-kicker,
  .viewer-toolbar strong,
  .viewer-toolbar span:not(.viewer-kicker) {
    max-width: calc(100vw - 260px);
  }
}

@media (max-width: 560px) {
  .top-bar {
    padding: 10px 12px;
  }

  .top-brand strong {
    font-size: 0.92rem;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-nav-button {
    justify-content: flex-start;
  }

  .control-panel {
    padding: 16px;
  }

  .library-shell {
    padding: 16px;
  }

  .library-header {
    align-items: stretch;
    flex-direction: column;
  }

  .library-table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .library-table-actions {
    justify-content: flex-start;
  }

  .library-drop-zone {
    grid-template-columns: 28px 44px minmax(0, 1fr);
  }

  .library-material-table {
    min-width: 900px;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    max-width: 100%;
    width: fit-content;
  }

  .drop-zone {
    grid-template-columns: 28px 44px minmax(0, 1fr);
  }

  .asset-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .clear-asset-button {
    min-height: 38px;
  }

  .drop-action {
    display: none;
  }

  .assignment-row {
    grid-template-columns: 1fr;
  }

  .material-options-list {
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .viewer-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .viewer-kicker,
  .viewer-toolbar strong,
  .viewer-toolbar span:not(.viewer-kicker) {
    max-width: 100%;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
