/* SVG to PNG Converter (r1) */
#s2p-tool [hidden] { display: none !important; }

/* Upload: full drop zone first, a compact bar after the first file */
#s2p-tool .upload-zone:focus-visible { outline: 3px solid #2F6BFF; outline-offset: 3px; }
#s2p-tool .upload-zone.s2p-compact { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 16px; margin-bottom: 14px; }
#s2p-tool .upload-zone.s2p-compact .upload-icon { width: 40px; height: 40px; margin: 0; flex: 0 0 auto; }
#s2p-tool .upload-zone.s2p-compact .upload-title { font-size: 15px; margin: 0; }
#s2p-tool .upload-zone.s2p-compact .upload-subtitle { font-size: 13px; margin: 0; }
#s2p-tool .upload-zone.s2p-compact .upload-hint { display: none; }

.s2p-paste { margin: 0 0 16px; padding: 10px 14px; background: #FFFFFF; border: 1px solid rgba(17, 18, 23, 0.10); border-radius: 8px; }
.s2p-paste summary { cursor: pointer; font-size: 14px; font-weight: 700; color: #111217; padding: 4px 0; }
.s2p-paste .input-label { color: #4B5563; margin: 10px 0 6px; }
.s2p-paste textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #F8FAFC; color: #111217; border: 1px solid rgba(17, 18, 23, 0.16); }
.s2p-paste .btn { margin-top: 10px; }

/* Preview */
.s2p-head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.s2p-zoom.seg { width: auto; padding: 3px; background: #F1F3F6; border: 1px solid rgba(17, 18, 23, 0.12); }
.s2p-zoom.seg button { flex: 0 0 auto; padding: 6px 12px; color: #374151; }
.s2p-zoom.seg button.active { background: #2F6BFF; color: #FFFFFF; }
.s2p-zoom.seg button:not(.active):hover { background: #E5E7EB; color: #111217; }
.s2p-preview { min-height: 240px; overflow: hidden; }
.s2p-preview.is-actual { display: block; overflow: auto; max-height: 70vh; padding: 16px; }
.s2p-preview img { display: block; max-width: none; flex: 0 0 auto; }
.s2p-notes { list-style: none; margin: 0; padding: 0 18px 16px; display: grid; gap: 6px; }
.s2p-notes:empty { display: none; }
.s2p-notes li { font-size: 13px; line-height: 1.5; color: #1F2937; padding: 8px 12px; border-radius: 6px; background: #F1F5FF; border-left: 3px solid #2F6BFF; }
.s2p-notes li.is-warn { background: #FFFBEB; border-left-color: #B45309; color: #78350F; }

/* File list */
.s2p-files { list-style: none; margin: 0; padding: 8px; display: grid; gap: 6px; max-height: 440px; overflow: auto; }
.s2p-file { display: flex; align-items: center; gap: 6px; padding: 4px; background: #FFFFFF; border: 1px solid rgba(17, 18, 23, 0.10); border-radius: 8px; }
.s2p-file.is-selected { border-color: #2F6BFF; box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.18); }
.s2p-pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 6px; background: none; border: 0; border-radius: 6px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.s2p-pick:hover { background: #F6F7F9; }
.s2p-thumb { flex: 0 0 52px; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 6px; border: 1px solid rgba(17, 18, 23, 0.08);
  background: linear-gradient(45deg, #EEF1F5 25%, transparent 25%), linear-gradient(-45deg, #EEF1F5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #EEF1F5 75%), linear-gradient(-45deg, transparent 75%, #EEF1F5 75%), #FFFFFF;
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; }
.s2p-thumb img { max-width: 44px; max-height: 44px; width: auto; height: auto; }
.s2p-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.s2p-name { font-size: 14px; font-weight: 700; color: #111217; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s2p-sub { font-size: 12.5px; line-height: 1.45; color: #4B5563; overflow-wrap: anywhere; }
.s2p-out { color: #1D4ED8; font-weight: 700; }
.s2p-last { color: #047857; }
.s2p-badge { align-self: flex-start; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #78350F; background: #FEF3C7; }
.s2p-icon-btn { flex: 0 0 44px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 8px; border: 1px solid rgba(17, 18, 23, 0.12); background: #FFFFFF; color: #111217; cursor: pointer; }
.s2p-icon-btn:hover:not(:disabled) { border-color: #2F6BFF; color: #2F6BFF; }
.s2p-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.s2p-icon-btn .ui-icon { width: 20px; height: 20px; margin: 0; }

/* Actions, status and the canvas hand-off */
.s2p-summary { margin: -8px 0 12px; font-size: 13px; line-height: 1.5; color: #374151; }
.s2p-summary a { font-weight: 700; color: #1D4ED8; }
.s2p-status { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: #1E3A8A; }
.s2p-handoff { margin: 0 0 16px; padding: 16px 18px; background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 8px; }
.s2p-handoff p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: #1E293B; }
.s2p-handoff .btn { display: inline-flex; }

/* Settings (dark aside) */
.s2p-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.s2p-chip { min-height: 36px; padding: 6px 11px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.16); background: #292C33; color: rgba(255, 255, 255, 0.88); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.s2p-chip:hover { border-color: rgba(157, 185, 255, 0.7); color: #FFFFFF; }
.s2p-chip[aria-pressed="true"] { background: #2F6BFF; border-color: #2F6BFF; color: #FFFFFF; }
.s2p-field-help { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.66); }
.s2p-error { margin: 8px 0 0; font-size: 12.5px; font-weight: 700; color: #FCA5A5; }
.tool-aside input[aria-invalid="true"] { border-color: #F87171; }
.s2p-color-row { display: flex; gap: 8px; margin-top: 10px; }
.s2p-color-row input[type="color"] { flex: 0 0 56px; width: 56px; }
.s2p-color-row input[type="text"] { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; }
.tool-aside .seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.tool-aside .help-note a { color: #9DB9FF; }

/* Visible keyboard focus on both the light stage and the dark aside */
.s2p-pick:focus-visible, .s2p-icon-btn:focus-visible, .s2p-zoom button:focus-visible, .s2p-paste summary:focus-visible, .s2p-handoff a:focus-visible, .s2p-summary a:focus-visible { outline: 3px solid #2F6BFF; outline-offset: 2px; }
.tool-aside .s2p-chip:focus-visible, .tool-aside .seg button:focus-visible, .tool-aside .settings-header:focus-visible, .tool-aside select:focus-visible, .tool-aside input:focus-visible { outline: 2px solid #9DB9FF; outline-offset: 2px; }

/* 44 px tap targets on phones and other touch screens */
@media (max-width: 640px), (pointer: coarse) {
  .s2p-chip, #s2p-tool .seg button, .s2p-zoom.seg button { min-height: 44px; }
  .s2p-paste summary { padding: 12px 0; }
}

@media (max-width: 640px) {
  .s2p-thumb { flex-basis: 44px; width: 44px; height: 44px; }
  .s2p-thumb img { max-width: 38px; max-height: 38px; }
  .s2p-pick { gap: 10px; padding: 4px; }
  .s2p-head-tools { justify-content: flex-start; }
  .stage-card-head { flex-wrap: wrap; }
  .s2p-handoff .btn { width: 100%; justify-content: center; }
}
