/* ============================================================
   SAVAGE DESIGNS — UPSCALE PANEL
   ============================================================

   Styles the INSIDE of the shared upscale panel only. Where the panel sits —
   floating over the board, docked in a sidebar, pushed inline — stays with each
   view, because that is genuinely the view's business and they disagree. Same
   arrangement as css/defringe.css, and the custom properties resolve because
   every page already loads css/styles.css.
   ============================================================ */

.us-panel { width: 100%; }

.us-wrap {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.us-col { display: flex; flex-direction: column; gap: 0.35rem; }
.us-col-ctl  { flex: 1 1 250px; min-width: 230px; }
.us-col-prev { flex: 0 1 320px; min-width: 240px; }

.us-head { margin-bottom: 0.35rem; }
.us-title { font-size: 0.9rem; color: var(--text); display: block; }
.us-sub {
  font-size: 0.72rem; color: var(--text-muted);
  line-height: 1.5; margin: 0.2rem 0 0;
}

.us-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-dim); margin-top: 0.35rem;
}

.us-hint {
  font-size: 0.7rem; color: var(--text-muted);
  line-height: 1.5; margin: 0.35rem 0 0.2rem;
}
.us-hint-tight { margin: 0.3rem 0 0.1rem; }

.us-note {
  font-size: 0.72rem; color: var(--text); line-height: 1.5;
  margin: 0.45rem 0 0;
}

/* ── Factor chooser ──────────────────────────────────────────────────────── */

.us-factors { display: flex; gap: 0.4rem; margin-top: 0.2rem; }

.us-factor {
  flex: 1 1 0;
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}
.us-factor strong { font-size: 0.85rem; color: var(--text); line-height: 1.2; }
.us-factor span {
  font-size: 0.65rem; color: var(--text-muted); line-height: 1.35;
}
.us-factor:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.us-factor.active { border-color: var(--accent); background: var(--card); }
.us-factor.active strong { color: var(--accent); }
.us-factor:disabled { opacity: 0.5; cursor: default; }

/* ── Preview stage ───────────────────────────────────────────────────────── */

.us-stage {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.us-stage canvas {
  display: block;
  /* The canvas is already drawn at its final size — let it stay crisp rather
     than picking up a second round of browser smoothing on the way to screen. */
  image-rendering: auto;
  max-width: 100%; max-height: 100%;
}

.us-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--accent); color: #fff;
  pointer-events: none;
}
.us-badge.is-before { background: var(--text-muted); }

.us-prev-actions {
  display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap; margin-top: 0.4rem;
}

.us-compare {
  font-size: 0.7rem; font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.us-compare:hover { border-color: var(--accent); color: var(--accent); }

.us-link {
  font-size: 0.7rem;
  padding: 0.3rem 0;
  border: 0; background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.us-link:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

/* ── Actions ─────────────────────────────────────────────────────────────── */

.us-actions {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.us-status {
  font-size: 0.72rem; color: var(--text-muted); font-style: italic;
  white-space: nowrap;
}

/* Progress bar. Hidden until there is something to report, and it takes the
   spare width so the status text and buttons don't jump when it appears. */
.us-bar {
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  visibility: hidden;
  min-width: 2rem;
}
.us-bar.show { visibility: visible; }
.us-bar > i {
  display: block; height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.15s linear;
}

.us-apply { border-color: var(--accent) !important; color: var(--accent) !important; }
.us-actions .toolbar-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
  .us-stage { height: 170px; }
  .us-col-prev { flex: 1 1 240px; }
}
