﻿:root {
  color-scheme: dark;
  --bg: #080a10;
  --bg-1: #0e1119;
  --bg-2: #151a24;
  --panel: rgba(15, 19, 28, 0.92);
  --panel-soft: rgba(22, 28, 39, 0.72);
  --line: rgba(128, 151, 185, 0.18);
  --line-strong: rgba(132, 171, 221, 0.32);
  --cyan: #45d7ff;
  --cyan-d: rgba(69, 215, 255, 0.1);
  --cyan-b: rgba(69, 215, 255, 0.24);
  --orange: #ff784f;
  --green: #4ee3a1;
  --yellow: #ffd166;
  --red: #ff6874;
  --violet: #a991ff;
  --text: #eef3fb;
  --text2: #a6b3c7;
  --text3: #68778f;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --body: "Outfit", Inter, Segoe UI, Arial, sans-serif;
  --display: "Rajdhani", Inter, Segoe UI, sans-serif;
  --hdr: 46px;
  --tbar: 54px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  border-radius: 6px;
}

.vwr-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: var(--hdr) 1fr var(--tbar);
  background:
    radial-gradient(circle at 20% 0%, rgba(69, 215, 255, 0.08), transparent 30%),
    var(--bg);
}

.vwr-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 16px;
  background: rgba(12, 15, 22, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.vwr-logo {
  flex: 0 0 auto;
  color: var(--text);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  transition: color 160ms ease;
}

.vwr-logo:hover {
  color: var(--cyan);
}

.vwr-logo em {
  color: var(--cyan);
  font-style: normal;
}

.vwr-logo sub {
  margin-left: 8px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  vertical-align: middle;
}

.hdr-mid {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.hdr-fmt {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--cyan-b);
  background: var(--cyan-d);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hdr-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hdr-stat,
.tb-info {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.hdr-stat em {
  color: var(--cyan);
  font-style: normal;
}

.hdr-stat.ok {
  color: var(--green);
}

.vwr-body {
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.vwr-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#viewer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.drop-zone {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.drop-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(69, 215, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 215, 255, 0.12) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.54;
  animation: grid-drift 26s linear infinite;
}

@keyframes grid-drift {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

.drop-zone.dragover {
  background: rgba(69, 215, 255, 0.06);
}

.drop-zone.hidden {
  display: none;
}

.dz-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, calc(100% - 56px));
  padding: 36px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(13, 17, 26, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  text-align: center;
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 24px;
  border: 1px solid var(--cyan-b);
  border-radius: 8px;
  background: rgba(69, 215, 255, 0.09);
  color: var(--cyan);
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
}

.dz-title {
  color: var(--text);
  font-family: var(--display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.dz-sub {
  margin: 12px 0 22px;
  color: var(--text2);
  font-size: 15px;
  line-height: 1.6;
}

.dz-formats,
.drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.dz-formats span {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(21, 26, 36, 0.82);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.6px;
}

.drop-actions {
  margin-top: 24px;
  gap: 10px;
}

.drop-actions button,
.tb-btn,
.vb,
.sp-reload-btn,
.sp-anim-btn,
.sp-speed-btn,
.tex-panel-close {
  min-height: 34px;
  border: 1px solid var(--line);
  background: rgba(22, 28, 39, 0.92);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.18s;
}

.drop-actions button {
  min-height: 40px;
  padding: 0 16px;
  color: var(--text);
}

.drop-actions button:hover,
.tb-btn:hover,
.tb-btn.on,
.vb:hover,
.vb.on,
.sp-reload-btn:hover,
.sp-anim-btn:hover,
.sp-anim-btn.active,
.sp-speed-btn:hover,
.sp-speed-btn.active {
  border-color: var(--cyan);
  background: var(--cyan-d);
  color: var(--cyan);
}

.drop-actions button:hover,
.tb-btn:hover,
.vb:hover {
  transform: translateY(-1px);
}

.dz-note {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 1;
  margin: 0;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.vwr-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(8, 10, 16, 0.78);
  text-align: center;
  backdrop-filter: blur(6px);
}

.vwr-loading.active {
  display: grid;
}

.ld-ring {
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  border: 2px solid rgba(69, 215, 255, 0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ld-label {
  color: var(--cyan);
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
}

.ld-sub {
  max-width: 440px;
  margin-top: 8px;
  overflow: hidden;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vwr-error {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 30;
  display: none;
  max-width: min(700px, calc(100% - 48px));
  transform: translateX(-50%);
  padding: 13px 16px;
  border: 1px solid rgba(255, 104, 116, 0.42);
  border-radius: 8px;
  background: rgba(255, 104, 116, 0.1);
  color: var(--red);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}

.vwr-error.active {
  display: block;
}

.view-btns {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vb {
  width: 68px;
  background: rgba(9, 12, 18, 0.82);
  backdrop-filter: blur(12px);
}

.tex-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 7;
  display: none;
  width: min(350px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(13, 17, 26, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.tex-panel.active {
  display: block;
}

.tex-panel-title {
  margin: 10px 0 14px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.tex-panel-close {
  width: 100%;
}

.texture-editor {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--text3);
  font-size: 12px;
}

.texture-map-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(21, 26, 36, 0.86);
}

.texture-thumb {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111722;
  object-fit: cover;
}

.texture-map-title {
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.texture-map-meta {
  margin-top: 3px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
}

.texture-map-row button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.stats-panel {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: rgba(13, 17, 26, 0.98);
  transition: width 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

.stats-panel.active {
  width: 336px;
  overflow-y: auto;
  overflow-x: hidden;
}

.stats-panel::-webkit-scrollbar {
  width: 4px;
}

.stats-panel::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.sp-top,
.sp-section,
.sp-score {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.sp-reload-btn {
  width: 100%;
  padding: 10px 16px;
}

.sp-section-title {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 9px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.7px;
  text-align: left;
  text-transform: uppercase;
}

.sp-section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.sp-section.collapsed .sp-section-body {
  display: none;
}

.sp-section.collapsed .sp-section-title span {
  transform: rotate(-90deg);
}

.sp-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(128, 151, 185, 0.1);
}

.sp-key {
  color: var(--text2);
  font-size: 12px;
}

.sp-val {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  text-align: right;
}

.cyan { color: var(--cyan); }
.green { color: var(--green); }
.warn { color: var(--yellow); }
.bad { color: var(--red); }

.sp-empty {
  padding: 8px 0;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
}

.sp-mesh-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--mono);
  font-size: 10px;
}

.sp-mesh-table th,
.sp-mesh-table td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(128, 151, 185, 0.12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-mesh-table th {
  color: var(--text3);
  font-weight: 400;
  text-align: left;
}

.sp-mesh-table td {
  color: var(--text2);
}

.sp-tex-list {
  margin-top: 9px;
}

.sp-tex-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  margin-bottom: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(21, 26, 36, 0.74);
}

.sp-tex-label {
  color: var(--text2);
  font-size: 12px;
}

.sp-tex-dim {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
}

.sp-mat-card {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 9px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(21, 26, 36, 0.76);
}

.sp-mat-swatch {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.sp-mat-name {
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-mat-props,
.sp-mat-tex-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.sp-mat-props span,
.sp-mat-dot {
  padding: 2px 6px;
  border: 1px solid rgba(69, 215, 255, 0.16);
  border-radius: 4px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
}

.sp-mat-props em {
  color: var(--cyan);
  font-style: normal;
}

.sp-anim-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

.sp-anim-controls,
.sp-speed-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.sp-anim-time,
.sp-speed-label {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
}

.sp-anim-bar-wrap,
.sp-score-bar-wrap,
.sp-mem-bar-wrap {
  width: 100%;
  height: 5px;
  margin-top: 11px;
  border-radius: 999px;
  overflow: hidden;
  background: #202838;
}

.sp-anim-bar,
.sp-score-bar,
.sp-mem-geo,
.sp-mem-tex {
  height: 100%;
  width: 0;
  transition: width 0.22s ease;
}

.sp-anim-bar,
.sp-score-bar,
.sp-mem-geo {
  background: var(--cyan);
}

.sp-mem-tex {
  background: var(--orange);
}

.sp-mem-bar-wrap {
  display: flex;
}

.sp-mem-legend {
  display: flex;
  gap: 12px;
  margin-top: 9px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}

.dot.geo { background: var(--cyan); }
.dot.tex { background: var(--orange); }

.sp-score-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sp-score-label {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sp-score-num {
  color: var(--cyan);
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
}

.sp-score-den {
  margin-left: 2px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 12px;
}

.sp-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 13px;
}

.sp-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(21, 26, 36, 0.76);
}

.sp-check.ok { border-color: rgba(78, 227, 161, 0.18); }
.sp-check.warn { border-color: rgba(255, 209, 102, 0.2); }
.sp-check.bad { border-color: rgba(255, 104, 116, 0.2); }
.sp-check.info { border-color: var(--cyan-b); }

.sp-ck-icon {
  width: 20px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
}

.sp-ck-lbl {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.sp-ck-det {
  display: block;
  margin-top: 2px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.vwr-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: rgba(12, 15, 22, 0.96);
}

.tb-btn {
  padding: 0 13px;
}

.tb-btn.primary {
  border-color: rgba(255, 120, 79, 0.82);
  background: linear-gradient(180deg, #ff875f, #f2653d);
  color: white;
}

.tb-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.tb-sep {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.tb-gap {
  flex: 1;
}

.bg-swatches {
  display: flex;
  gap: 7px;
}

.bg-sw {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.bg-sw.on {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

#file-input,
#folder-input,
#texture-input {
  display: none;
}

@media (max-width: 920px) {
  .vwr-shell {
    grid-template-rows: var(--hdr) minmax(0, 1fr) auto;
  }

  .vwr-body {
    flex-direction: column;
  }

  .stats-panel.active {
    width: 100%;
    max-height: 42vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .vwr-toolbar {
    flex-wrap: wrap;
    min-height: var(--tbar);
    padding: 9px 12px;
  }

  .hdr-right {
    display: none;
  }

  .dz-title {
    font-size: 30px;
  }

  .dz-inner {
    width: min(520px, calc(100% - 32px));
    padding: 28px 22px;
  }
}
