.upscale-panel {
  color: var(--fg); background: var(--raised); border: 1px solid var(--line-2);
  border-radius: var(--r4); padding: var(--sp-5); width: min(640px, calc(100% - 32px));
  max-height: 88dvh; overflow-y: auto; box-shadow: var(--sh-4);
  --well: var(--chrome); --well-focus: var(--sunken);
}
.upscale-panel::backdrop { background: rgba(8,8,10,.8); backdrop-filter: blur(4px); }
.upscale-panel [hidden] { display: none !important; }
.upscale-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.upscale-heading h2 { font-size: var(--fz-lg); font-weight: var(--fw-semibold); margin: 0; }
.upscale-source { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.upscale-source img { width: 112px; height: 112px; flex: none; object-fit: contain; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r2); }
.upscale-source > div { min-width: 0; }
#upscaleSourceMeta { overflow-wrap: anywhere; font-size: var(--fz-sm); margin: 0 0 12px; }
.upscale-field { display: grid; gap: 8px; min-width: 0; margin-bottom: 12px; font-size: var(--fz-xs); color: var(--fg-2); }
.upscale-field select, .upscale-field textarea { width: 100%; min-width: 0; }
.upscale-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.upscale-note { font-size: var(--fz-xs); color: var(--fg-3); line-height: 1.6; margin: 10px 0 16px; }
.upscale-source .upscale-note { margin-bottom: 0; }
.upscale-billing { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.upscale-billing strong { font-size: var(--fz-sm); }
.upscale-billing span { font-size: var(--fz-xs); color: var(--fg-3); }
.upscale-error { font-size: var(--fz-xs); color: var(--danger, #ed8c85); line-height: 1.6; overflow-wrap: anywhere; }
.upscale-error:empty, #upscaleStatus:empty { display: none; }
.upscale-controls { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.upscale-results { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.upscale-results h3 { font-size: var(--fz-sm); font-weight: var(--fw-semibold); margin: 0 0 16px; }
.upscale-result + .upscale-result { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.upscale-result > img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; background: var(--sunken); border-radius: var(--r2); }
.upscale-result-meta { display: grid; gap: 5px; margin-top: 12px; font-size: var(--fz-xs); color: var(--fg-3); overflow-wrap: anywhere; }
.upscale-result-meta strong { color: var(--fg-2); font-weight: var(--fw-medium); }
.upscale-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.upscale-result-actions a { text-decoration: none; }
@media (max-width: 640px) {
  .upscale-panel { margin: auto 0 0; width: 100%; max-width: none; max-height: 90dvh; border-radius: 15px 15px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .upscale-source { gap: 12px; }
  .upscale-source img { width: 80px; height: 96px; }
  .upscale-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .upscale-panel .ibtn { width: 44px; height: 44px; }
  .upscale-panel .btn { min-height: 44px; }
}
