/* ── Sprite Calibration panel (SpriteCalibration.js) ── */

.sc-panel-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sc-card {
  padding: 16px 20px;
}

.sc-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sc-head h2 {
  margin: 0;
}

.sc-head .sc-hint {
  flex-basis: 100%;
  margin: 4px 0 0 0;
  color: #888;
  font-size: 13px;
}

.sc-head-actions {
  display: flex;
  gap: 8px;
}

.sc-head-actions .btn-secondary.active {
  background: #2a6ed0;
  color: #fff;
  border-color: #2a6ed0;
}

.sc-empty {
  color: #777;
  text-align: center;
  padding: 24px 8px;
}

/* ── Calibrate view ── */

.sc-calibrate {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.sc-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 640px;
}

.sc-picker-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-picker-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #2a2c34;
  border-radius: 6px;
  padding: 6px;
  background: #15171c;
}

.sc-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.sc-picker-row:hover {
  background: #1f2229;
}

.sc-picker-row.active {
  background: #1b2a44;
  border-color: #2a6ed0;
}

.sc-picker-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f1115;
  border-radius: 4px;
  overflow: hidden;
}

.sc-picker-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sc-picker-meta {
  min-width: 0;
}

.sc-picker-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-picker-sub {
  color: #888;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-thumb-missing {
  color: #555;
  font-size: 10px;
}

/* ── Ruler (BOX 1) ── */

.sc-ruler {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sc-ruler-empty {
  padding: 40px 20px;
  text-align: center;
  color: #777;
  border: 2px dashed #2a2c34;
  border-radius: 6px;
}

.sc-ruler-stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}

#scRulerCanvas {
  background: #1b1d22;
  border: 1px solid #2a2c34;
  border-radius: 6px;
  image-rendering: pixelated;
}

.sc-ruler-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 240px;
}

.sc-hud {
  background: #15171c;
  border: 1px solid #2a2c34;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.sc-hud code {
  background: #0f1115;
  padding: 1px 4px;
  border-radius: 3px;
}

.sc-slider-row {
  display: grid;
  grid-template-columns: 50px 1fr 80px;
  gap: 8px;
  align-items: center;
}

.sc-scale-number {
  text-align: right;
}

.sc-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sc-preset-btn {
  font-size: 11px;
  padding: 4px 8px;
}

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

.sc-save-status {
  font-size: 12px;
  color: #6ec878;
}

.sc-save-status.sc-status-error {
  color: #e57373;
}

/* ── Gallery view ── */

.sc-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sc-gallery-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-gallery-head .sc-hint {
  margin: 0;
  color: #888;
  font-size: 12px;
}

.sc-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.sc-gallery-card {
  background: #15171c;
  border: 1px solid #2a2c34;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.1s;
}

.sc-gallery-card:hover {
  border-color: #2a6ed0;
}

.sc-gallery-canvas {
  width: 100%;
  height: 240px;
  display: block;
  image-rendering: pixelated;
}

.sc-gallery-caption {
  padding: 6px 4px 0;
  font-size: 11px;
}

.sc-gallery-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-gallery-sub {
  color: #888;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .sc-calibrate {
    grid-template-columns: 1fr;
  }
  .sc-ruler-stage {
    grid-template-columns: 1fr;
  }
}
