* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #0f1115;
  color: #f2f3f5;
}

body {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  width: 100%;
  height: 100vh;
}

.sidebar {
  background: #171a21;
  border-right: 1px solid #252a35;
  padding: 20px;
  overflow-y: auto;
}

.sidebar h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

.hint, .small, .panel p, .panel code {
  color: #c4cad5;
  line-height: 1.5;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 24px;
}

.controls button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #272d39;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.controls button:hover {
  background: #333b4b;
}

.panel {
  margin-top: 22px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.viewer-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
}

#viewer {
  width: 100%;
  height: 100%;
}

#loadingOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.4);
  color: white;
  font-size: 18px;
  z-index: 10;
  text-align: center;
  padding: 24px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.swatch {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
}

.swatch.active {
  outline: 3px solid #ffffff;
}

code {
  display: inline-block;
  background: #202632;
  padding: 8px 10px;
  border-radius: 8px;
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #252a35;
  }
}
