/* SVG Color Editor (svg-color-editor.html) - scoped to this page's tool area */
#tool [hidden] { display: none !important; }
#tool :focus-visible { outline: 2px solid #2F6BFF; outline-offset: 2px; }
#tool .tool-aside :focus-visible { outline-color: #9DB9FF; }
#tool .btn-secondary:hover:not(:disabled) { color: #111827; }
#tool .seg button:not(.active):hover { color: #111827; }
#tool .tool-aside .btn-secondary { background: #FFFFFF; color: #111827; }

/* Upload: full zone first, then a slim bar so another file can be loaded on any device */
#tool .upload-zone.is-compact { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; padding: 10px 14px; margin-bottom: 12px; }
#tool .upload-zone.is-compact .upload-icon { width: 34px; height: 34px; margin: 0; border-radius: 8px; }
#tool .upload-zone.is-compact .upload-title { font-size: 14px; margin: 0; }
#tool .upload-zone.is-compact .upload-subtitle { font-size: 13px; margin: 0; }
#tool .upload-zone.is-compact .upload-hint { display: none; }

.sce-paste { margin: 0 0 18px; border: 1px solid rgba(17,18,23,0.12); border-radius: 8px; background: #FFFFFF; }
.sce-paste summary { cursor: pointer; padding: 11px 14px; font-size: 13.5px; font-weight: 700; color: #1D4ED8; min-height: 44px; display: flex; align-items: center; gap: 10px; list-style: none; }
.sce-paste summary::-webkit-details-marker { display: none; }
.sce-paste summary::before { content: "+"; width: 22px; height: 22px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #EFF6FF; border: 1px solid #BFDBFE; font-weight: 800; }
.sce-paste[open] summary::before { content: "\2212"; }
.sce-paste[open] summary { border-bottom: 1px solid rgba(17,18,23,0.10); }
.sce-paste-body { padding: 12px 14px 14px; }
#tool .sce-paste .input-label { color: #334155; }
.sce-paste textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #F8FAFC; color: #111827; }
.sce-paste .btn { margin-top: 10px; }

/* Preview */
.sce-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 14px 18px 0; }
.sce-toolbar .seg { width: auto; min-width: 220px; }
.sce-toolbar .seg button { min-height: 36px; }
.sce-toolbar-note { font-size: 12.5px; color: #475569; }
.sce-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 18px 18px; }
.sce-tile { margin: 0; min-width: 0; }
.sce-frame { height: 220px; border-radius: 8px; border: 1px solid rgba(17,18,23,0.12); display: flex; align-items: center; justify-content: center; padding: 18px; overflow: hidden; }
.sce-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sce-light .sce-frame { background: var(--sce-light, #FFFFFF); }
.sce-dark .sce-frame { background: var(--sce-dark, #0F172A); border-color: rgba(17,18,23,0.4); }
.sce-checker .sce-frame {
  background-color: #FFFFFF;
  background-image: linear-gradient(45deg, #D7DDE5 25%, transparent 25%), linear-gradient(-45deg, #D7DDE5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #D7DDE5 75%), linear-gradient(-45deg, transparent 75%, #D7DDE5 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.sce-tile figcaption { font-size: 12px; font-weight: 600; color: #475569; margin-top: 6px; text-align: center; }
.sce-empty { padding: 56px 20px; text-align: center; color: #475569; font-size: 14px; }
.sce-empty strong { display: block; color: #111827; font-size: 15px; margin-bottom: 4px; }
#tool .sce-notes { margin: 0 0 18px; }
#tool .sce-notes p { margin: 0 0 6px; color: #475569; }
#tool .sce-notes p:last-child { margin-bottom: 0; }
#tool .sce-notes a { color: #1D4ED8; text-decoration: underline; }

/* Color list (dark aside) */
.sce-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sce-list:empty { display: none; }
.sce-row { border: 1px solid rgba(255,255,255,0.10); border-radius: 8px; padding: 10px 12px; background: #292C33; }
.sce-row.is-changed { border-color: #2F6BFF; box-shadow: inset 3px 0 0 #2F6BFF; }
.sce-row-top { display: flex; align-items: center; gap: 10px; }
.sce-chip { position: relative; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.28);
  background: #FFFFFF linear-gradient(45deg, #CBD5E1 25%, transparent 25%, transparent 75%, #CBD5E1 75%) 0 0 / 10px 10px; }
.sce-chip > span { position: absolute; inset: 0; }
.sce-chip.is-current > span { background: linear-gradient(135deg, #111827 50%, #F8FAFC 50%); }
.sce-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sce-code { font: 700 13px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #FFFFFF; overflow-wrap: anywhere; }
.sce-uses { font-size: 11.5px; line-height: 1.4; color: rgba(255,255,255,0.62); }
.sce-icon-btn { width: 36px; height: 36px; flex: 0 0 auto; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid rgba(255,255,255,0.18); background: #202228; color: rgba(255,255,255,0.82); cursor: pointer; }
.sce-icon-btn svg { width: 17px; height: 17px; }
.sce-icon-btn:hover:not(:disabled) { border-color: #9DB9FF; color: #FFFFFF; }
.sce-icon-btn[aria-pressed="true"] { background: #2F6BFF; border-color: #2F6BFF; color: #FFFFFF; }
.sce-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sce-row-edit { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.sce-arrow { flex: 0 0 auto; color: rgba(255,255,255,0.5); font-weight: 700; }
#tool .sce-row-edit input[type="color"] { width: 44px; height: 38px; padding: 3px; flex: 0 0 auto; cursor: pointer; }
#tool .sce-row-edit input[type="text"] { flex: 1; min-width: 0; height: 38px; padding: 7px 10px; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sce-cc { flex: 0 0 auto; height: 38px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.18); background: #202228; color: rgba(255,255,255,0.82);
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; cursor: pointer; }
.sce-cc:hover { border-color: #9DB9FF; color: #FFFFFF; }
.sce-cc[aria-pressed="true"] { background: #2F6BFF; border-color: #2F6BFF; color: #FFFFFF; }
#tool input[aria-invalid="true"] { border-color: #F87171 !important; box-shadow: 0 0 0 2px rgba(248,113,113,0.35); }

.sce-pick { display: flex; gap: 8px; }
#tool .sce-pick input[type="color"] { width: 52px; flex: 0 0 auto; }
#tool .sce-pick input[type="text"] { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sce-stack { display: grid; gap: 8px; margin-top: 12px; }
.sce-stack .btn { width: 100%; }
.sce-bg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#tool .tool-aside .help-note a { color: #9DB9FF; text-decoration: underline; }
#tool .tool-aside .help-note code { color: #FFFFFF; }

@media (min-width: 1025px) {
  .sce-list { max-height: min(56vh, 540px); overflow-y: auto; padding-right: 4px; }
}
/* Touch screens: 44px tap targets for the row controls */
@media (pointer: coarse) {
  .sce-icon-btn { width: 44px; height: 44px; }
  #tool .sce-row-edit input[type="color"], #tool .sce-row-edit input[type="text"], .sce-cc { height: 44px; }
}
@media (max-width: 640px) {
  .sce-previews { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .sce-light { grid-column: 1 / -1; }
  .sce-frame { height: 150px; padding: 12px; }
  .sce-toolbar { padding: 12px 12px 0; }
  .sce-toolbar .seg { width: 100%; }
}
