:root {
  --desktop: #008080;
  --app-workspace: #808080;
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --highlight: #ffffff;
  --shadow: #808080;
  --dark-shadow: #0a0a0a;
  --window-bg: #ffffff;
  --ink: #000000;
  --muted: #404040;
  --title-start: #000080;
  --title-end: #1084d0;
  --selection: #000080;
  --selection-text: #ffffff;
  --info-bg: #ffffe1;
  --warn-ink: #800000;
  --ok-ink: #006400;

  --bevel-window:
    inset -1px -1px 0 var(--dark-shadow),
    inset 1px 1px 0 var(--face-light),
    inset -2px -2px 0 var(--shadow),
    inset 2px 2px 0 var(--highlight);
  --bevel-raised:
    inset -1px -1px 0 var(--dark-shadow),
    inset 1px 1px 0 var(--highlight),
    inset -2px -2px 0 var(--shadow),
    inset 2px 2px 0 var(--face-light);
  --bevel-sunken:
    inset 1px 1px 0 var(--shadow),
    inset 2px 2px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset -2px -2px 0 var(--face-light);
  --bevel-sunken-thin:
    inset 1px 1px 0 var(--shadow),
    inset -1px -1px 0 var(--highlight);

  --dither-active: repeating-conic-gradient(var(--face) 0% 25%, #e4e4e4 0% 50%) 0 0 / 2px 2px;

  --font-ui: 'Tahoma', 'MS Sans Serif', 'Microsoft Sans Serif', 'Geneva', 'Verdana', sans-serif;
  --font-mono: 'Lucida Console', 'Courier New', 'Fixedsys', monospace;
}

* {
  box-sizing: border-box;
  border-radius: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--desktop);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

body {
  padding: 10px;
}

@media (max-width: 720px) {
  body {
    padding: 0;
  }
}

code,
kbd,
.mono-meta,
output,
input[type="text"],
select {
  font-family: var(--font-mono);
}

code {
  font-size: 11px;
  background: var(--window-bg);
  border: 1px solid var(--shadow);
  padding: 0 3px;
}

kbd {
  display: inline-block;
  padding: 1px 4px;
  font-size: 11px;
  background: var(--face);
  box-shadow: var(--bevel-raised);
}

.hidden {
  display: none !important;
}

/* Main Win98 Application Window */
.app-window {
  max-width: 1460px;
  min-height: calc(100vh - 20px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--face);
  box-shadow: var(--bevel-window);
  padding: 3px;
}

@media (max-width: 720px) {
  .app-window {
    min-height: 100vh;
  }
}

/* Classic Title Bar */
.win-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
  padding: 2px 3px 2px 4px;
  background: linear-gradient(90deg, var(--title-start) 0%, var(--title-end) 100%);
  color: var(--selection-text);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.01em;
  user-select: none;
}

.win-title-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.win-icon {
  flex: none;
  display: block;
}

.win-title-text,
.win-titlebar h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-caption-btns {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.win-cap-btn {
  appearance: none;
  width: 16px;
  height: 14px;
  padding: 0;
  border: 0;
  background: var(--face);
  color: var(--ink);
  box-shadow: var(--bevel-raised);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  line-height: 11px;
  text-align: center;
  cursor: pointer;
}

.win-cap-btn:disabled {
  color: var(--ink);
  cursor: default;
  opacity: 1;
}

.win-cap-btn:not(:disabled):active {
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 1px 0 0 1px;
}

/* Menu Bar */
.win-menubar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 3px;
  background: var(--face);
  border-bottom: 1px solid var(--shadow);
  box-shadow: inset 0 -1px 0 var(--highlight);
  position: relative;
  z-index: 30;
}

.menu-item {
  position: relative;
}

.menu-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
}

.menu-trigger:hover {
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    inset -1px -1px 0 var(--shadow);
}

.menu-item.open .menu-trigger {
  background: var(--selection);
  color: var(--selection-text);
  box-shadow: none;
}

.menu-trigger:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: -2px;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 196px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-window);
  z-index: 40;
}

.menu-item.open .menu-dropdown {
  display: flex;
  flex-direction: column;
}

.menu-entry {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 11px;
  text-align: left;
  padding: 4px 16px 4px 18px;
  cursor: pointer;
  white-space: nowrap;
}

.menu-entry:hover {
  background: var(--selection);
  color: var(--selection-text);
}

.menu-sep {
  height: 0;
  margin: 3px 2px;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--highlight);
}

/* Coolbar / Toolbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  background: var(--face);
  border-bottom: 1px solid var(--shadow);
  box-shadow: inset 0 -1px 0 var(--highlight);
}

.toolbar-grip {
  width: 4px;
  height: 22px;
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    inset -1px -1px 0 var(--shadow);
  margin-right: 2px;
  flex: none;
}

.toolbar-sep {
  width: 0;
  height: 22px;
  border-left: 1px solid var(--shadow);
  border-right: 1px solid var(--highlight);
  margin: 0 2px;
  flex: none;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.export-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink);
}

.field-inline select,
.select-compact {
  height: 22px;
  padding: 1px 4px;
  font-size: 11px;
  background: var(--window-bg);
  color: var(--ink);
  border: 0;
  box-shadow: var(--bevel-sunken);
  cursor: pointer;
}

.field-inline select:focus,
.select-compact:focus {
  outline: 1px dotted var(--ink);
  outline-offset: -3px;
}

/* Classic 3D Win98 Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 23px;
  padding: 3px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink);
  background: var(--face);
  border: 0;
  box-shadow: var(--bevel-raised);
  cursor: pointer;
  white-space: nowrap;
}

.btn-pixel-icon {
  flex: none;
  display: block;
}

.btn:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: -4px;
}

.btn:active:not(:disabled) {
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 4px 9px 2px 11px;
}

.btn:disabled {
  color: var(--shadow);
  text-shadow: 1px 1px 0 var(--highlight);
  cursor: default;
}

.btn-primary {
  font-weight: 700;
  box-shadow:
    inset 0 0 0 1px var(--dark-shadow),
    inset -2px -2px 0 var(--dark-shadow),
    inset 2px 2px 0 var(--highlight),
    inset -3px -3px 0 var(--shadow),
    inset 3px 3px 0 var(--face-light);
  padding: 3px 12px;
}

.btn-primary:active:not(:disabled) {
  box-shadow:
    inset 0 0 0 1px var(--dark-shadow),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 4px 11px 2px 13px;
}

.btn-mousex {
  font-weight: 700;
  color: var(--title-start);
  box-shadow:
    inset 0 0 0 1px var(--dark-shadow),
    inset -2px -2px 0 var(--dark-shadow),
    inset 2px 2px 0 var(--highlight),
    inset -3px -3px 0 var(--shadow),
    inset 3px 3px 0 var(--face-light);
}

.btn-mousex:disabled {
  color: var(--shadow);
}

.btn-secondary {
  background: var(--face);
}

.btn-xs {
  min-height: 20px;
  padding: 2px 8px;
  font-size: 11px;
}

.btn-xs:active:not(:disabled) {
  padding: 3px 7px 1px 9px;
}

/* Drop Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(rgba(0, 0, 0, 0.35) 0% 25%, transparent 0% 50%) 0 0 / 2px 2px;
}

.drop-overlay-card {
  width: min(440px, calc(100vw - 24px));
  background: var(--face);
  box-shadow: var(--bevel-window);
  padding: 3px;
}

.drop-overlay-body {
  padding: 14px;
}

.drop-overlay-well {
  padding: 24px 18px;
  text-align: center;
  background: var(--window-bg);
  border: 1px dashed var(--title-start);
  box-shadow: var(--bevel-sunken-thin);
}

.drop-overlay-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--title-start);
}

.drop-overlay-sub {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

/* Main Workspace Client Frame */
.workspace {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  margin: 4px 2px;
  padding: 8px;
  background: var(--face);
  box-shadow: var(--bevel-sunken-thin);
}

/* Empty State inside MDI Sunken Client */
.empty-state {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 440px;
  padding: 20px;
  background: var(--app-workspace);
  box-shadow: var(--bevel-sunken);
}

.empty-card {
  width: 100%;
  max-width: 560px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-window);
}

.win-titlebar-sub {
  background: linear-gradient(90deg, var(--title-start) 0%, var(--title-end) 100%);
}

.empty-card-body {
  padding: 14px 16px 16px;
}

.empty-hero-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 520px) {
  .empty-hero-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.empty-icon {
  flex: none;
  padding: 4px;
  background: var(--face);
  box-shadow: var(--bevel-sunken-thin);
}

.empty-icon svg {
  display: block;
}

.empty-copy h2 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.empty-copy p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink);
}

.empty-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.paste-hint {
  font-size: 11px;
  color: var(--muted);
}

/* Classic Etched GroupBox */
.win-groupbox {
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--shadow);
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    1px 1px 0 var(--highlight);
  min-width: 0;
}

.win-groupbox legend {
  padding: 0 5px;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink);
}

.empty-specs-box {
  background: var(--face);
}

.empty-specs {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink);
}

/* Split Workbench */
.workbench {
  display: grid;
  grid-template-columns: minmax(310px, 430px) 1fr;
  gap: 10px;
  align-items: start;
}

@media (max-width: 980px) {
  .workbench {
    grid-template-columns: 1fr;
  }
}

.pane {
  background: var(--face);
  padding: 10px;
  border: 1px solid var(--shadow);
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    1px 1px 0 var(--highlight);
  min-width: 0;
}

.pane-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--shadow);
  box-shadow: 0 1px 0 var(--highlight);
}

.pane-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pane-header h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--title-start);
}

.mono-meta {
  font-size: 11px;
  color: var(--muted);
}

/* Sunken Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  box-shadow: var(--bevel-sunken-thin);
}

.badge-info {
  background: var(--info-bg);
  color: var(--title-start);
}

.badge-ok {
  background: var(--window-bg);
  color: var(--ok-ink);
}

.badge-warn {
  background: var(--info-bg);
  color: var(--warn-ink);
}

/* Left Pane Controls */
.sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: var(--face);
  padding: 3px 9px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--dither-active);
  font-weight: 700;
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 4px 8px 2px 10px;
}

.sheet-quick-btns {
  display: flex;
  gap: 4px;
}

.sheet-stage-wrap {
  background: var(--app-workspace);
  box-shadow: var(--bevel-sunken);
  padding: 8px;
  text-align: center;
  margin-bottom: 10px;
}

#sheet-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 430px;
  object-fit: contain;
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
  background: #404040;
}

#sheet-canvas:active {
  cursor: grabbing;
}

.stage-hint {
  margin: 6px 0 0;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--highlight);
  background: #404040;
  border: 1px solid var(--shadow);
}

.grid-sliders-box {
  margin-top: 4px;
}

.grid-sliders {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 520px) {
  .grid-sliders {
    grid-template-columns: 1fr;
  }
}

.slider-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 400;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.slider-top output {
  font-size: 11px;
  color: var(--title-start);
  background: var(--window-bg);
  padding: 0 4px;
  box-shadow: var(--bevel-sunken-thin);
  min-width: 34px;
  text-align: right;
}

/* Classic Win98 Range Trackbar */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

input[type="range"]:focus-visible {
  outline: 1px dotted var(--ink);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--window-bg);
  box-shadow:
    inset 1px 1px 0 var(--shadow),
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 20px;
  margin-top: -8px;
  background: var(--face);
  border: 0;
  box-shadow: var(--bevel-raised);
}

input[type="range"]:disabled::-webkit-slider-thumb {
  background: var(--face);
  opacity: 0.7;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--window-bg);
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 20px;
  border: 0;
  border-radius: 0;
  background: var(--face);
  box-shadow: var(--bevel-raised);
}

/* Right Pane Controls & Backdrops */
.backdrop-switcher {
  display: inline-flex;
  gap: 2px;
}

.bg-chip {
  appearance: none;
  border: 0;
  background: var(--face);
  padding: 2px 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.bg-chip.active {
  background: var(--dither-active);
  font-weight: 700;
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 3px 7px 1px 9px;
}

.controls-fieldset {
  margin-bottom: 10px;
}

.controls-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(95px, 1fr));
  gap: 10px;
  align-items: end;
}

@media (max-width: 1120px) {
  .controls-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .controls-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

.toggles-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-top: 8px;
  border-top: 1px solid var(--shadow);
  box-shadow: inset 0 1px 0 var(--highlight);
}

/* Classic Win98 Plain Square Checkboxes */
.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  user-select: none;
}

.toggle-pill input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 13px;
  height: 13px;
  margin: 0;
  background: var(--window-bg);
  box-shadow: var(--bevel-sunken);
  cursor: pointer;
  position: relative;
}

.toggle-pill input[type="checkbox"]:checked {
  background-color: var(--window-bg);
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath d='M1 4h1v1h1v1h1V4h1V3h1V2h1V1h1v2H7v1H6v1H5v1H4v1H3V6H2V5H1z' fill='%23000000'/%3E%3C/svg%3E");
}

.toggle-pill input[type="checkbox"]:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

.hotspot-global-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  border: 1px solid var(--shadow);
  box-shadow: inset 1px 1px 0 var(--highlight);
}

.btn-hs-all {
  appearance: none;
  border: 0;
  padding: 2px 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink);
  background: var(--face);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.btn-hs-all:active {
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow);
  padding: 3px 5px 1px 7px;
}

/* Animation Transport Bar (classic Win98 MPlayer bar) */
.anim-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 10px;
  background: var(--face);
  box-shadow: var(--bevel-sunken-thin);
}

.anim-scrubber {
  flex: 1 1 160px;
  min-width: 120px;
}

.anim-label {
  min-width: 96px;
  padding: 1px 6px;
  background: var(--window-bg);
  box-shadow: var(--bevel-sunken-thin);
  color: var(--ink);
}

/* 3x3 Extracted Cursor Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 720px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.cursor-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  background: var(--face);
  box-shadow: var(--bevel-raised);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.card-meta-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-num {
  font-weight: 700;
  color: var(--title-start);
}

.btn-flip {
  appearance: none;
  border: 0;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  color: var(--ink);
  background: var(--face);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.btn-flip.active {
  background: var(--dither-active);
  color: var(--title-start);
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
}

.anim-pill {
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--info-bg);
  color: var(--warn-ink);
  border: 1px solid var(--ink);
}

.card-meta-right {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.bg-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35);
  display: inline-block;
}

.preview-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  box-shadow: var(--bevel-sunken);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-canvas-box {
  position: relative;
  width: 86%;
  height: 86%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.preview-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  pointer-events: none;
}

/* Crisp Pixel Crosshair */
.hotspot-marker {
  position: absolute;
  width: 15px;
  height: 15px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hotspot-marker::before,
.hotspot-marker::after {
  content: "";
  position: absolute;
  background: #ff0000;
  box-shadow: 0 0 0 1px #ffffff;
}

.hotspot-marker::before {
  left: 0;
  right: 0;
  top: 7px;
  height: 1px;
}

.hotspot-marker::after {
  top: 0;
  bottom: 0;
  left: 7px;
  width: 1px;
}

.card-hotspot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hs-presets {
  display: inline-flex;
  gap: 2px;
}

.btn-hs {
  appearance: none;
  border: 0;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: var(--face);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.btn-hs.active {
  background: var(--dither-active);
  color: var(--warn-ink);
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
}

.hs-coords {
  font-size: 10px;
  white-space: nowrap;
  color: var(--ink);
  background: var(--window-bg);
  padding: 1px 4px;
  box-shadow: var(--bevel-sunken-thin);
}

.hotspot-note {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 3px 6px;
  font-size: 11px;
  background: var(--info-bg);
  color: var(--warn-ink);
  border: 1px solid var(--ink);
}

.btn-link-switch {
  appearance: none;
  border: 0;
  padding: 1px 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--title-start);
  background: var(--face);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.btn-link-switch:active {
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow);
}

[data-pixelated="true"] .preview-stage canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Backdrop styles */
[data-backdrop="checker"] .preview-stage,
.insp-canvas-wrap[data-backdrop="checker"] {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #c0c0c0 25%, transparent 25%),
    linear-gradient(-45deg, #c0c0c0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c0c0c0 75%),
    linear-gradient(-45deg, transparent 75%, #c0c0c0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

[data-backdrop="dark"] .preview-stage {
  background: #000000;
}

[data-backdrop="light"] .preview-stage {
  background: #ffffff;
}

[data-backdrop="chroma"] .preview-stage {
  background: #00ff00;
}

.card-name-input {
  width: 100%;
  height: 21px;
  padding: 2px 5px;
  font-size: 11px;
  color: var(--ink);
  background: var(--window-bg);
  border: 0;
  box-shadow: var(--bevel-sunken);
}

.card-name-input:focus {
  outline: 1px dotted var(--ink);
  outline-offset: -3px;
}

.card-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px;
}

.btn-flip-dl {
  width: 100%;
  color: var(--title-start);
  font-weight: 700;
}

/* Bottom Export Pack Bar */
.export-zip-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: var(--face);
  border: 1px solid var(--shadow);
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    1px 1px 0 var(--highlight);
}

.export-zip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-zip-info strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--title-start);
}

.export-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.skin-name-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.skin-name-field input {
  width: 145px;
  height: 22px;
  padding: 2px 5px;
  font-size: 11px;
  color: var(--ink);
  background: var(--window-bg);
  border: 0;
  box-shadow: var(--bevel-sunken);
}

.skin-name-field input:focus {
  outline: 1px dotted var(--ink);
  outline-offset: -3px;
}

/* Bottom Win98 Status Bar */
.win-statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px;
  padding: 2px 2px 1px;
  background: var(--face);
  font-size: 11px;
}

.status-pane {
  padding: 2px 6px;
  box-shadow: var(--bevel-sunken-thin);
  display: flex;
  align-items: center;
  min-height: 20px;
  color: var(--ink);
}

.status-main {
  flex: 1 1 260px;
}

.status-mid {
  flex: 0 0 auto;
  min-width: 140px;
}

.status-right {
  flex: 0 0 auto;
  gap: 8px;
  padding-right: 2px;
}

.win-resize-grip {
  width: 13px;
  height: 13px;
  display: inline-block;
  align-self: flex-end;
  background-image: linear-gradient(
    -45deg,
    var(--highlight) 1px,
    transparent 1px,
    transparent 3px,
    var(--shadow) 3px,
    var(--shadow) 4px,
    var(--highlight) 4px,
    var(--highlight) 5px,
    transparent 5px,
    transparent 7px,
    var(--shadow) 7px,
    var(--shadow) 8px,
    var(--highlight) 8px,
    var(--highlight) 9px,
    transparent 9px
  );
}

/* Win98 Dialog Windows (Inspector & About) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(rgba(0, 0, 0, 0.28) 0% 25%, transparent 0% 50%) 0 0 / 2px 2px;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  background: var(--face);
  box-shadow: var(--bevel-window);
  padding: 3px;
}

.modal-content {
  padding: 10px;
}

.modal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.modal-header p {
  margin: 0;
}

.modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--shadow);
  box-shadow: inset 0 -1px 0 var(--highlight);
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.tool-btn {
  appearance: none;
  border: 0;
  padding: 3px 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink);
  background: var(--face);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.tool-btn.active {
  background: var(--dither-active);
  font-weight: 700;
  box-shadow:
    inset 1px 1px 0 var(--dark-shadow),
    inset -1px -1px 0 var(--highlight),
    inset 2px 2px 0 var(--shadow),
    inset -2px -2px 0 var(--face-light);
  padding: 4px 7px 2px 9px;
}

.modal-actions-right {
  display: flex;
  gap: 4px;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
}

@media (max-width: 680px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.insp-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 10px;
  box-shadow: var(--bevel-sunken);
}

#insp-canvas {
  max-width: 100%;
  max-height: 360px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

.insp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: var(--face);
  border: 1px solid var(--shadow);
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    1px 1px 0 var(--highlight);
}

.insp-tol-box,
.insp-colors-box,
.insp-hotspot-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--shadow);
  box-shadow: inset 0 1px 0 var(--highlight);
}

.insp-label {
  font-size: 11px;
  font-weight: 700;
}

.extra-colors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.extra-color-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink);
  background: var(--face);
  border: 0;
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.extra-color-pill i {
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
  display: inline-block;
}

/* About Dialog */
.about-panel {
  max-width: 410px;
}

.about-body {
  padding: 14px;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 12px;
}

.about-hero strong {
  display: block;
  font-size: 12px;
  color: var(--title-start);
}

.about-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.about-divider {
  height: 0;
  margin: 12px 0;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--highlight);
}

.about-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.6;
}

.about-footer {
  display: flex;
  justify-content: flex-end;
}
