:root {
  color-scheme: light;
  font-family: "Google Sans", "Product Sans", "Roboto", "Noto Sans SC", system-ui, sans-serif;
  --md-primary: #006a6a;
  --md-on-primary: #ffffff;
  --md-primary-container: #6ff7f4;
  --md-on-primary-container: #002020;
  --md-secondary: #4a6363;
  --md-on-secondary: #ffffff;
  --md-secondary-container: #cce8e7;
  --md-on-secondary-container: #051f1f;
  --md-tertiary: #53617d;
  --md-tertiary-container: #dae2ff;
  --md-error: #ba1a1a;
  --md-error-container: #ffdad6;
  --md-background: #f4fbfa;
  --md-on-background: #161d1d;
  --md-surface: #f4fbfa;
  --md-surface-dim: #d5dbda;
  --md-surface-container-lowest: #ffffff;
  --md-surface-container-low: #eff5f4;
  --md-surface-container: #e9efee;
  --md-surface-container-high: #e3e9e8;
  --md-surface-container-highest: #dde4e3;
  --md-on-surface: #161d1d;
  --md-on-surface-variant: #3f4948;
  --md-outline: #6f7978;
  --md-outline-variant: #bec9c8;
  --md-inverse-surface: #2b3231;
  --md-inverse-on-surface: #ecf2f1;
  --md-shadow: rgba(0, 0, 0, 0.18);
  --md-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --md-elevation-2: 0 2px 6px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --md-elevation-3: 0 6px 18px rgba(0, 0, 0, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  /* 默认允许纵向滚动；转换台桌面布局在 .converter-body 媒体查询里再锁死 */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  color: var(--md-on-background);
  background:
    radial-gradient(circle at 12% 0%, rgba(111, 247, 244, 0.32), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(218, 226, 255, 0.58), transparent 30%),
    linear-gradient(180deg, #fbfffe, var(--md-background));
}

.i18n-pending .shell {
  opacity: 0;
  visibility: hidden;
}

.shell {
  opacity: 1;
  transition: opacity 120ms ease;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.shell {
  width: 100%;
  min-height: 100vh;
  height: auto;
  margin: 0;
  padding: 24px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100vh - 48px);
}

.page {
  display: grid;
  grid-template-columns: minmax(380px, 480px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  flex: 1;
  min-height: 760px;
}

.hidden,
.mode-hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--md-surface-container-lowest) 88%, transparent);
  box-shadow: var(--md-elevation-1);
  padding: 20px 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.top-actions .secondary {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

.language-switch {
  position: relative;
  display: block;
  min-width: 112px;
}

.language-native-select {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.language-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--md-outline);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72)),
    var(--md-surface-container-lowest);
  color: var(--md-on-surface);
  padding: 0 16px 0 20px;
  font-weight: 700;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 14%, transparent);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.language-menu-button:hover,
.language-switch.open .language-menu-button {
  border-color: var(--md-primary);
  box-shadow: var(--md-elevation-2), 0 0 0 3px color-mix(in srgb, var(--md-primary) 16%, transparent);
  transform: translateY(-1px);
}

.language-menu-button::after {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--md-on-surface-variant);
  border-bottom: 2px solid var(--md-on-surface-variant);
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.language-switch.open .language-menu-button::after {
  transform: translateY(2px) rotate(225deg);
}

.language-menu-button span {
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.language-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 132px;
  border: 1px solid color-mix(in srgb, var(--md-outline-variant) 84%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--md-surface-container-lowest) 96%, transparent);
  box-shadow: var(--md-elevation-3);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition: opacity 120ms ease, transform 120ms ease;
}

.language-switch.open .language-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.language-menu-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--md-on-surface);
  padding: 0 12px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.language-menu-option:hover,
.language-menu-option:focus-visible {
  background: var(--md-surface-container-high);
  outline: none;
}

.language-menu-option[aria-selected="true"] {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}

.language-menu-option[aria-selected="true"]::after {
  width: 9px;
  height: 5px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  content: "";
  transform: rotate(-45deg);
}

label span,
.source-choice legend,
.export-choice legend,
.backend-choice legend,
.folder-picker-field > label,
.folder-picker-field small,
.preview-meta,
.preview-time {
  color: var(--md-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--md-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 650;
  line-height: 0.98;
}

h2 {
  font-size: 24px;
  font-weight: 650;
}

.status-pill {
  display: grid;
  place-items: center;
  min-width: 120px;
  min-height: 40px;
  border-radius: 999px;
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  padding: 0 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: lowercase;
}

.status-pill.error {
  color: var(--md-error);
  background: var(--md-error-container);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-column: 1;
  grid-row: 1;
  gap: 18px;
  min-height: 0;
  overflow: auto;
}

.panel {
  border: 1px solid color-mix(in srgb, var(--md-outline-variant) 72%, transparent);
  border-radius: 28px;
  background: var(--md-surface-container-low);
  box-shadow: var(--md-elevation-1);
}

.uploader,
.monitor,
.log-panel {
  padding: 18px;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 178px;
  place-items: center;
  border: 2px dashed var(--md-outline-variant);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(111, 247, 244, 0.22), transparent 52%),
    var(--md-surface-container);
  cursor: pointer;
  overflow: hidden;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--md-primary);
  background: var(--md-primary-container);
  box-shadow: var(--md-elevation-2);
  transform: translateY(-1px);
}

.drop-zone input,
.source-choice input,
.export-choice input,
.backend-choice input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-mark {
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--md-primary);
  color: var(--md-on-primary);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
}

.drop-zone strong {
  display: block;
  color: var(--md-on-surface);
  font-size: 24px;
  font-weight: 650;
  text-align: center;
  overflow-wrap: anywhere;
}

.drop-zone small {
  color: var(--md-on-surface-variant);
  margin-top: 8px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.source-choice,
.export-choice,
.backend-choice {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.source-choice {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

#converterPage.fbx-preview-mode .grid {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr);
  align-self: stretch;
  overflow: hidden;
}

#converterPage.fbx-preview-mode .uploader {
  height: 100%;
  min-height: 0;
}

#converterPage.fbx-preview-mode {
  display: grid;
  grid-template-columns: minmax(300px, 480px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  height: auto;
  min-height: 0;
}

#converterPage.fbx-preview-mode .preview-panel {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  height: 100%;
  min-height: 0;
}

#converterPage.fbx-preview-mode .viewer-wrap {
  height: 100%;
  min-height: 0;
}

#converterPage.fbx-preview-mode .fields > :not(.source-choice),
#converterPage.fbx-preview-mode #submitBtn,
#converterPage.fbx-preview-mode .monitor,
#converterPage.fbx-preview-mode .log-panel {
  display: none !important;
}

.export-choice {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.backend-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-choice legend,
.export-choice legend,
.backend-choice legend {
  grid-column: 1 / -1;
}

.source-choice label,
.backend-choice label {
  position: relative;
  min-height: 44px;
  border: 1px solid var(--md-outline);
  border-radius: 999px;
  background: var(--md-surface-container-lowest);
  cursor: pointer;
}

.export-choice label {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 64px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface-container-lowest);
  cursor: pointer;
  overflow: hidden;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.export-choice label:hover {
  border-color: var(--md-outline);
  background: var(--md-surface-container);
}

.export-choice label:active {
  transform: scale(0.985);
}

.export-choice span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 62px;
  margin: 0;
  color: var(--md-on-surface-variant);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.export-choice span::before {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--md-outline);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--md-surface-container-lowest);
  content: "";
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.export-choice label:has(input:checked) {
  border-color: var(--md-primary);
  background: var(--md-secondary-container);
  box-shadow: 0 0 0 1px var(--md-primary);
}

.export-choice label:has(input:checked) span {
  color: var(--md-on-secondary-container);
}

.export-choice label:has(input:checked) span::before {
  border-color: var(--md-primary);
  background: var(--md-primary);
  box-shadow: inset 0 0 0 4px var(--md-secondary-container);
}

.export-choice label:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--md-primary) 28%, transparent);
  outline-offset: 2px;
}

.source-choice span,
.backend-choice span {
  display: grid;
  min-height: 42px;
  place-items: center;
  margin: 0;
  color: var(--md-on-surface-variant);
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.source-choice label:has(input:checked),
.backend-choice label:has(input:checked) {
  border-color: var(--md-primary);
  background: var(--md-secondary-container);
}

.source-choice label:has(input:checked) span,
.backend-choice label:has(input:checked) span {
  color: var(--md-on-secondary-container);
}

.batch-only,
.checkbox-field {
  grid-column: 1 / -1;
}

.folder-picker-field > label,
.folder-picker-field small {
  display: block;
}

.folder-picker-field > label {
  margin-bottom: 7px;
}

.folder-picker-field small {
  margin-top: 7px;
}

.folder-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  gap: 8px;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

label span {
  display: block;
  margin-bottom: 7px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--md-outline);
  border-radius: 12px;
  background: var(--md-surface-container-lowest);
  color: var(--md-on-surface);
  padding: 0 14px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 16px;
  background: var(--md-surface-container-lowest);
  padding: 0 14px;
  cursor: pointer;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--md-primary);
  cursor: pointer;
}

.checkbox-field span {
  margin: 0;
  color: var(--md-on-surface);
}

input:focus,
select:focus,
button:focus-visible,
.drop-zone:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--md-primary) 38%, transparent);
  outline-offset: 2px;
}

.primary,
.secondary,
.ghost {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.primary {
  width: 100%;
  margin-top: 14px;
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-elevation-1);
}

.secondary {
  width: 100%;
  border: 1px solid var(--md-outline);
  background: var(--md-surface-container-lowest);
  color: var(--md-primary);
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--md-primary);
}

.primary:hover:not(:disabled),
.secondary:hover:not(:disabled),
.ghost:hover:not(:disabled) {
  box-shadow: var(--md-elevation-2);
  transform: translateY(-1px);
}

.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(1);
  box-shadow: none;
}

.compact {
  min-height: 40px;
  padding: 0 14px;
}

.standard-pose-field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.standard-pose-field .secondary {
  width: 100%;
}

.standard-pose-field .secondary.active {
  border-color: var(--md-primary);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.standard-pose-hint {
  color: var(--md-on-surface-variant);
  font-size: 12px;
  line-height: 1.5;
}

.standard-pose-hint.active {
  color: var(--md-primary);
  font-weight: 600;
}

.meter-head,
.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#percentText {
  color: var(--md-primary);
  font-size: 34px;
  font-weight: 650;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: var(--md-surface-container-highest);
  margin: 18px 0;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--md-primary), #2f7de1);
  transition: width 220ms ease;
}

.steps {
  display: grid;
  gap: 6px;
}

.step {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--md-on-surface-variant);
  min-height: 24px;
  line-height: 1.25;
}

.step > span:first-child {
  width: 12px;
  height: 12px;
  border: 2px solid var(--md-outline);
  border-radius: 999px;
  background: transparent;
}

.step > span:not(:first-child) {
  overflow-wrap: anywhere;
}

.step.active,
.step.done {
  color: var(--md-on-surface);
}

.step.active > span:first-child,
.step.done > span:first-child {
  background: var(--md-primary);
  border-color: var(--md-primary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.stat,
.download {
  border-radius: 18px;
  background: var(--md-surface-container);
  padding: 12px;
}

.stat strong,
.download strong {
  display: block;
  overflow-wrap: anywhere;
}

.stat small,
.download small {
  color: var(--md-on-surface-variant);
}

.downloads {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--md-on-surface);
  text-decoration: none;
}

.download:hover {
  background: var(--md-secondary-container);
}

.download-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.download-row .download {
  flex: 1;
  min-width: 0;
}

.download-reopen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  border-radius: 18px;
  background: var(--md-tertiary-container);
  color: var(--md-on-secondary-container);
  padding: 0 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.download-reopen:hover {
  background: var(--md-tertiary);
  color: var(--md-on-primary);
}

.preview-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  align-self: start;
  height: auto;
  min-height: 0;
  padding: 18px;
}

.preview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.preview-meta,
.preview-time {
  text-align: right;
}

.viewer-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  height: clamp(220px, calc(100dvh - 260px), 420px);
  min-height: 0;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--md-inverse-surface);
  background-size: 40px 40px;
  overflow: hidden;
}

.preview-compare-legend {
  position: absolute;
  z-index: 4;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(10, 13, 10, 0.78);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  padding: 8px 12px;
  color: rgba(247, 246, 238, 0.78);
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.preview-compare-legend.hidden {
  display: none;
}

.compare-role,
.compare-sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.compare-role > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.compare-role-human {
  color: #b8ff5d;
}

.compare-role-g1 {
  color: #78d7ff;
}

.compare-role b {
  color: currentColor;
  font-size: 11px;
}

.compare-sync {
  color: rgba(247, 246, 238, 0.55);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.compare-sync i {
  width: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 246, 238, 0.45));
}

.compare-sync i:last-child {
  transform: scaleX(-1);
}

#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
  touch-action: none;
}

#previewCanvas:active {
  cursor: grabbing;
}

#previewCanvas.preview-canvas-disabled {
  cursor: default;
}

#previewCanvas.preview-canvas-disabled:active {
  cursor: default;
}

.preview-empty {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: color-mix(in srgb, var(--md-inverse-on-surface) 76%, transparent);
  pointer-events: auto;
  touch-action: auto;
  cursor: default;
}

.preview-empty span {
  justify-self: center;
  border-radius: 999px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  padding: 8px 14px;
  font-weight: 700;
}

.preview-empty strong {
  color: var(--md-inverse-on-surface);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.preview-empty small {
  max-width: 280px;
  padding: 0 12px;
  overflow-wrap: anywhere;
}

.preview-empty.hidden {
  display: none;
}

.preview-controls {
  display: grid;
  grid-template-columns: 96px 96px minmax(160px, 1fr) max-content;
  gap: 10px;
  align-items: center;
  align-self: end;
  margin-top: 12px;
}

.grip-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 6px;
}

.grip-length-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.grip-length-field input {
  width: 72px;
}

.grip-note {
  flex: 1 1 320px;
  min-width: 200px;
  font-size: 0.78rem;
  opacity: 0.72;
  line-height: 1.3;
}

.preview-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.preview-time::after {
  content: attr(data-frames);
  display: block;
  margin-top: 2px;
  opacity: 0.7;
}

.scrubber {
  min-height: 40px;
  padding: 0;
  accent-color: var(--md-primary);
}

.log-panel {
  grid-column: 1;
  grid-row: 2;
}

pre {
  margin: 12px 0 0;
  min-height: 76px;
  max-height: 108px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--md-inverse-on-surface);
  background: var(--md-inverse-surface);
  border-radius: 18px;
  padding: 14px;
  line-height: 1.45;
}

.recovery-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.recovery-topbar h1 {
  font-size: clamp(30px, 4vw, 48px);
}

.recovery-back {
  width: auto;
  color: var(--md-primary);
  text-decoration: none;
}

.recovery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  align-items: start;
  gap: 18px;
}

.recovery-workbench,
.recovery-evidence {
  padding: 24px;
}

.recovery-intro {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1.2fr);
  align-items: end;
  gap: 28px;
  margin-bottom: 22px;
}

.recovery-intro h2 {
  max-width: 480px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
}

.recovery-intro > p {
  margin: 0;
  color: var(--md-on-surface-variant);
  font-size: 14px;
  line-height: 1.65;
}

.recovery-drop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.recovery-drop {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 154px;
  border: 2px dashed var(--md-outline-variant);
  border-radius: 24px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--md-primary-container) 24%, transparent), transparent 58%),
    var(--md-surface-container-lowest);
  padding: 22px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.recovery-drop:hover,
.recovery-drop.dragging {
  border-color: var(--md-primary);
  background: var(--md-primary-container);
  box-shadow: var(--md-elevation-2);
  transform: translateY(-2px);
}

.recovery-drop.has-file {
  border-style: solid;
  border-color: var(--md-primary);
  background: color-mix(in srgb, var(--md-secondary-container) 78%, var(--md-surface-container-lowest));
}

.recovery-drop input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.recovery-file-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: var(--md-elevation-1);
}

.recovery-file-mark.sonic {
  background: var(--md-tertiary);
}

.recovery-drop-copy {
  min-width: 0;
}

.recovery-drop-copy strong,
.recovery-drop-copy small {
  display: block;
}

.recovery-drop-copy strong {
  color: var(--md-on-surface);
  font-size: 17px;
  line-height: 1.25;
}

.recovery-drop-copy small {
  margin-top: 8px;
  color: var(--md-on-surface-variant);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.recovery-link {
  display: grid;
  place-items: center;
}

.recovery-link span {
  position: relative;
  width: 100%;
  height: 2px;
  background: var(--md-outline-variant);
}

.recovery-link span::after {
  position: absolute;
  top: 50%;
  right: 0;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--md-primary);
  border-right: 2px solid var(--md-primary);
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.recovery-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.recovery-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.recovery-submit-row .primary {
  margin: 0;
}

.recovery-privacy {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--md-on-surface-variant);
}

.recovery-privacy > span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--md-primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.recovery-evidence {
  position: sticky;
  top: 24px;
}

.recovery-evidence #recoveryPercent {
  color: var(--md-primary);
  font-size: 34px;
  font-weight: 650;
}

.recovery-result {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.recovery-confidence,
.recovery-range {
  border-radius: 20px;
  background: var(--md-surface-container-lowest);
  padding: 16px;
}

.recovery-confidence {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recovery-confidence small,
.recovery-range small {
  display: block;
  color: var(--md-on-surface-variant);
  font-size: 11px;
}

.recovery-confidence strong,
.recovery-range strong {
  display: block;
  margin-top: 3px;
  color: var(--md-on-surface);
}

.confidence-badge {
  display: grid;
  min-width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: var(--md-surface-container-highest);
  color: var(--md-on-surface-variant);
  font-weight: 800;
}

.confidence-high {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.confidence-medium {
  background: #ffddb3;
  color: #2b1700;
}

.confidence-low {
  background: var(--md-error-container);
  color: var(--md-error);
}

.recovery-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.recovery-range > span {
  color: var(--md-primary);
  font-size: 24px;
}

.recovery-range strong {
  font-size: 28px;
}

.recovery-log {
  min-height: 230px;
  max-height: 360px;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    padding: 18px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 36px);
  }

  .page {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .grid {
    grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.75fr);
  }

  .grid,
  .preview-panel,
  .log-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .viewer-wrap {
    height: clamp(220px, calc(100dvh - 260px), 420px);
    min-height: 0;
  }

  .recovery-layout {
    grid-template-columns: 1fr;
  }

  .recovery-evidence {
    position: static;
  }
}

@media (max-width: 820px) {
  .shell {
    width: 100%;
    padding: 12px;
  }

  .workspace {
    min-height: calc(100vh - 24px);
  }

  #converterPage.fbx-preview-mode {
    display: flex;
    height: auto;
  }

  #converterPage.fbx-preview-mode .grid,
  #converterPage.fbx-preview-mode .preview-panel {
    width: 100%;
  }

  #converterPage.fbx-preview-mode .viewer-wrap {
    height: clamp(240px, 62vw, 360px);
    min-height: 0;
  }

  .topbar,
  .meter-head {
    align-items: start;
  }

  .topbar,
  .top-actions {
    flex-direction: column;
  }

  .top-actions,
  .top-actions .secondary,
  .status-pill {
    width: 100%;
  }

  .grid,
  .fields,
  .source-choice,
  .export-choice,
  .folder-picker-row,
  .preview-controls {
    grid-template-columns: 1fr;
  }

  .preview-head,
  .log-head {
    align-items: start;
    flex-direction: column;
  }

  .preview-meta,
  .preview-time {
    text-align: left;
  }

  .preview-compare-legend {
    top: 10px;
    gap: 8px;
    max-width: calc(100% - 20px);
    padding: 7px 10px;
  }

  .compare-sync span {
    display: none;
  }

  .recovery-intro,
  .recovery-drop-grid,
  .recovery-options,
  .recovery-submit-row {
    grid-template-columns: 1fr;
  }

  .recovery-link {
    min-height: 32px;
    transform: rotate(90deg);
  }
}

@media (min-width: 821px) {
  html,
  body.converter-body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.converter-body .shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.converter-body .workspace {
    height: 100%;
    min-height: 0;
  }

  body.converter-body .page {
    display: grid;
    grid-template-columns: minmax(300px, 480px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }

  body.converter-body .grid {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
  }

  body.converter-body .log-panel {
    grid-column: auto;
    grid-row: auto;
  }

  body.converter-body .preview-panel {
    grid-column: 2;
    grid-row: 1;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
    align-self: stretch;
    height: 100%;
    min-height: 0;
  }

  body.converter-body .viewer-wrap {
    height: 100%;
    min-height: 0;
  }
}

/* Auxiliary NPZ conversion stays in the scrollable controls column. */
.grit-npz-panel { padding: 18px; min-width: 0; }
.grit-npz-head h2 { font-size: 19px; line-height: 1.4; margin: 4px 0 10px; overflow-wrap: anywhere; }
.grit-npz-head > p:last-child, .grit-npz-hint { color: var(--md-on-surface-variant); font-size: 13px; line-height: 1.65; }
.grit-npz-head > p:last-child { margin: 0 0 14px; }
#gritNpzForm { display: grid; gap: 12px; min-width: 0; }
#gritNpzDropZone { min-height: 146px; padding: 16px; gap: 8px; box-sizing: border-box; }
#gritNpzDropZone .drop-mark { margin: 0; padding: 6px 12px; }
#gritNpzDropZone strong { font-size: 16px; line-height: 1.5; }
#gritNpzDropZone small { margin: 0; text-align: center; font-size: 12px; line-height: 1.6; }
#gritNpzDropZone.drag-over, #gritNpzDropZone:focus-within { border-color: var(--md-primary); background: var(--md-primary-container); }
.grit-npz-hint { margin: 0; }
#gritNpzResult { overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
#gritNpzResult:empty { display: none; }
