/* Brand Kit colors: swatch grid, popover editor, paste/logo/website helpers, contrast checks.
   Uses the app's tokens with fallbacks so the public share page renders the same without styles.css. */
.bkc { position: relative; --bkc-line: var(--line, #ebe6de); --bkc-line-2: var(--line-2, #e2dcd2); --bkc-ink: var(--ink, #1d1b18); --bkc-muted: var(--muted, #6f6a62); --bkc-faint: var(--faint, #9a948a); --bkc-surface: var(--surface, #fff); --bkc-ease: var(--ease, cubic-bezier(.22, 1, .36, 1)); font-family: var(--sans, system-ui, sans-serif); color: var(--bkc-ink); }
.bkc button { font: inherit; color: inherit; cursor: pointer; }
.bkc button:disabled { cursor: not-allowed; }
.bkc svg { flex: none; }
.bkc-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bkc-empty { margin: 0 0 12px; color: var(--bkc-muted); font-size: 14px; }

/* Grid of tiles */
.bkc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.bkc-tile { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--bkc-line); border-radius: 18px; background: var(--bkc-surface); box-shadow: var(--shadow-sm, 0 1px 2px rgba(29, 27, 24, .05)); transition: transform .25s var(--bkc-ease), box-shadow .25s var(--bkc-ease), border-color .2s, opacity .2s; }
.bkc-tile.is-new { animation: bkc-in .35s var(--bkc-ease) both; }
.bkc:not(.is-readonly) .bkc-tile:hover, .bkc-tile.is-open { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(29, 27, 24, .04), 0 14px 30px -14px rgba(29, 27, 24, .28); }
.bkc-tile.is-open { border-color: var(--bkc-ink); }
.bkc-tile.is-dragging { opacity: .45; }
.bkc-tile.is-over { border-color: var(--accent, #e0583a); box-shadow: 0 0 0 3px rgba(224, 88, 58, .18); }
.bkc:not(.is-readonly) .bkc-tile { cursor: grab; }
.bkc-tile.is-dragging { cursor: grabbing; }

.bkc-swatch { position: relative; display: block; width: 100%; height: 116px; margin: 0; padding: 0; border: 0; border-radius: 17px 17px 0 0; background: var(--sw); color: var(--on); box-shadow: inset 0 -1px 0 rgba(29, 27, 24, .06); text-align: left; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
button.bkc-swatch:focus-visible { outline: 3px solid var(--accent, #e0583a); outline-offset: 2px; z-index: 1; }
.bkc-role { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; color: var(--on); background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(4px); }
.bkc-tile.is-light .bkc-role { background: rgba(29, 27, 24, .07); border-color: rgba(29, 27, 24, .14); }
.bkc-pen { position: absolute; top: 9px; right: 9px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--bkc-ink); box-shadow: 0 2px 6px rgba(29, 27, 24, .15); opacity: 0; transform: scale(.85); transition: opacity .2s, transform .25s var(--bkc-ease); }
.bkc-swatch:hover .bkc-pen, .bkc-swatch:focus-visible .bkc-pen, .bkc-tile.is-open .bkc-pen { opacity: 1; transform: none; }

.bkc-move { position: absolute; top: 80px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.bkc-tile:hover .bkc-move, .bkc-tile:focus-within .bkc-move { opacity: 1; }
.bkc-move button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--bkc-ink); box-shadow: 0 2px 6px rgba(29, 27, 24, .15); transition: transform .2s var(--bkc-ease); }
.bkc-move button:hover:not(:disabled) { transform: scale(1.08); }
.bkc-move button:disabled { opacity: .35; }
.bkc-move button:focus-visible { outline: 2px solid var(--accent, #e0583a); outline-offset: 1px; }

.bkc-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.bkc-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.bkc-name.is-empty { color: var(--bkc-faint); font-weight: 500; font-style: italic; }
.bkc-hex { position: relative; display: inline-flex; align-items: center; gap: 5px; margin: -3px -6px; padding: 3px 6px; border: 0; border-radius: 7px; background: none; font: 500 12.5px/1.3 var(--mono, ui-monospace, monospace) !important; color: var(--bkc-muted) !important; transition: background .2s, color .2s; }
.bkc-hex svg { opacity: 0; transition: opacity .2s; }
.bkc-hex:hover, .bkc-hex:focus-visible { background: rgba(29, 27, 24, .06); color: var(--bkc-ink) !important; }
.bkc-hex:hover svg, .bkc-hex:focus-visible svg { opacity: 1; }
.bkc-hex:focus-visible { outline: 2px solid var(--accent, #e0583a); outline-offset: 1px; }
.bkc-copied { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; border-radius: 7px; background: var(--green, #268a52); color: #fff; font: 600 12px/1 var(--sans, system-ui, sans-serif); opacity: 0; transform: scale(.9); pointer-events: none; transition: opacity .2s, transform .25s var(--bkc-ease); }
.bkc-copied svg { opacity: 1 !important; }
.bkc-hex.is-copied .bkc-copied { opacity: 1; transform: none; }
.bkc-usage { font-size: 12.5px; line-height: 1.4; color: var(--bkc-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.bkc-crs { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.bkc-cr { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 7px; font-size: 11px; font-weight: 650; line-height: 1.5; border: 1px solid var(--bkc-line); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bkc-cr b { font-size: 12px; font-weight: 800; }
.bkc-cr.on-white { background: #fff; color: var(--green, #268a52); }
.bkc-cr.on-black { background: #141312; border-color: #141312; color: #7fd3a1; }
.bkc-cr.on-white.is-fail { color: var(--red, #c23b2a); }
.bkc-cr.on-black.is-fail { color: #ff9a8a; }

/* Add tile */
.bkc-add-li { display: flex; }
.bkc-add { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 176px; border: 1.5px dashed var(--bkc-line-2); border-radius: 18px; background: transparent; color: var(--bkc-muted); font-weight: 600; font-size: 14px; transition: border-color .2s, color .2s, background .2s, transform .25s var(--bkc-ease); }
.bkc-add svg { width: 26px; height: 26px; padding: 5px; box-sizing: content-box; border-radius: 50%; background: rgba(29, 27, 24, .05); transition: transform .35s var(--bkc-ease); }
.bkc-add:hover { border-color: var(--bkc-ink); color: var(--bkc-ink); background: rgba(255, 255, 255, .6); }
.bkc-add:hover svg { transform: rotate(90deg); }
.bkc-add:focus-visible { outline: 3px solid var(--accent, #e0583a); outline-offset: 2px; }
.bkc-none { grid-column: 1 / -1; color: var(--bkc-muted); font-size: 14px; }

/* Tools */
.bkc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.bkc-tool { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--bkc-line-2); border-radius: 999px; background: var(--bkc-surface); font-size: 13px; font-weight: 600; color: var(--ink-2, #3a3631) !important; box-shadow: var(--shadow-sm, none); transition: border-color .2s, transform .2s var(--bkc-ease); }
.bkc-tool:hover:not(:disabled) { border-color: #cfc6b8; transform: translateY(-1px); }
.bkc-tool[aria-expanded="true"] { border-color: var(--bkc-ink); }
.bkc-tool:disabled { opacity: .55; }
.bkc-tool:focus-visible { outline: 3px solid rgba(224, 88, 58, .35); outline-offset: 1px; }
.bkc-count { margin-left: auto; font-size: 12.5px; color: var(--bkc-faint); }

/* Paste panel */
.bkc-paste { margin-top: 12px; padding: 14px; border: 1px solid var(--bkc-line); border-radius: 16px; background: var(--surface-2, #fdfcfa); animation: bkc-in .3s var(--bkc-ease); }
.bkc-paste .bkc-lab { margin-top: 0; }
.bkc-paste-in { min-height: 76px; resize: vertical; font-family: var(--mono, ui-monospace, monospace); font-size: 13px; }
.bkc-paste-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.bkc-paste-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 24px; }
.bkc-paste-preview i { width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(29, 27, 24, .1); animation: bkc-in .25s var(--bkc-ease); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bkc-paste-preview i.is-dupe { opacity: .35; }
.bkc-paste-preview .bkc-hint { margin-left: 4px; }
.bkc-paste-actions { display: flex; gap: 6px; margin-left: auto; }

/* Suggestions */
.bkc-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; }
.bkc-sugg-title { font-size: 12.5px; font-weight: 600; color: var(--bkc-muted); min-width: 118px; }
.bkc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bkc-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 5px; border: 1px solid var(--bkc-line-2); border-radius: 999px; background: var(--bkc-surface); font: 500 12px/1 var(--mono, ui-monospace, monospace) !important; transition: border-color .2s, transform .2s var(--bkc-ease); }
.bkc-chip i { width: 20px; height: 20px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(29, 27, 24, .12); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bkc-chip:hover:not(:disabled) { border-color: var(--bkc-ink); transform: translateY(-1px); }
.bkc-chip.is-added { color: var(--green, #268a52) !important; border-color: transparent; background: var(--green-soft, #e2f3e8); opacity: 1; cursor: default; }
.bkc-chip:disabled:not(.is-added) { opacity: .5; }
.bkc-chip:focus-visible { outline: 3px solid rgba(224, 88, 58, .35); outline-offset: 1px; }

.bkc-link { border: 0; padding: 2px 4px; background: none; font-size: 13px; font-weight: 600; color: var(--accent, #e0583a) !important; text-decoration: underline; text-underline-offset: 3px; }
.bkc-note { display: flex; align-items: center; gap: 6px; min-height: 1.4em; margin: 10px 0 0; font-size: 13px; color: var(--green, #268a52); }
.bkc-note:empty { margin: 0; min-height: 0; }
.bkc-note.is-error { color: var(--red, #c23b2a); }
.bkc-tip { margin: 12px 0 0; font-size: 13px; color: var(--bkc-muted); }

/* Text-on-background checks */
.bkc-contrast { margin-top: 16px; padding: 14px; border: 1px solid var(--bkc-line); border-radius: 16px; background: var(--surface-2, #fdfcfa); }
.bkc-contrast h4 { margin: 0 0 8px; font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.bkc-contrast ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bkc-pair { display: flex; align-items: center; gap: 12px; }
.bkc-pair-sample { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font: 800 17px/1 var(--sans, system-ui, sans-serif); box-shadow: inset 0 0 0 1px rgba(29, 27, 24, .1); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bkc-pair-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.bkc-pair-text span { color: var(--bkc-muted); font-size: 12.5px; }
.bkc-pair-score { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bkc-ratio { font: 600 13px/1 var(--mono, ui-monospace, monospace); }
.bkc-grade { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--green-soft, #e2f3e8); color: var(--green, #268a52); }
.bkc-pair.is-warn .bkc-grade { background: var(--amber-soft, #fbf0d8); color: var(--amber, #b27812); }
.bkc-pair.is-fail .bkc-grade { background: var(--red-soft, #fde6e2); color: var(--red, #c23b2a); }

/* Shared controls */
.bkc-lab { display: block; margin: 12px 0 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2, #3a3631); }
.bkc-in { display: block; width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--bkc-line-2); border-radius: 11px; background: var(--bkc-surface); font: inherit; font-size: 14px; color: var(--bkc-ink); outline: none; transition: border-color .2s, box-shadow .2s; }
.bkc-in:focus { border-color: var(--accent, #e0583a); box-shadow: 0 0 0 4px rgba(224, 88, 58, .12); }
.bkc-in[aria-invalid="true"] { border-color: var(--red, #c23b2a); }
.bkc-mono { font-family: var(--mono, ui-monospace, monospace); letter-spacing: .02em; }
.bkc-select { appearance: none; padding-right: 32px; background: var(--bkc-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236f6a62' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/12px no-repeat; }
.bkc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 15px; border: 1px solid var(--bkc-line-2); border-radius: 999px; background: var(--bkc-surface); font-size: 13.5px; font-weight: 600; transition: transform .2s var(--bkc-ease), background .2s; }
.bkc-btn:hover:not(:disabled) { transform: translateY(-1px); }
.bkc-btn:disabled { opacity: .5; }
.bkc-btn.is-dark { border-color: var(--bkc-ink); background: var(--bkc-ink); color: #fff !important; }
.bkc-btn.is-danger { border-color: transparent; background: none; color: var(--red, #c23b2a) !important; }
.bkc-btn.is-danger:hover { background: var(--red-soft, #fde6e2); }
.bkc-btn:focus-visible { outline: 3px solid rgba(224, 88, 58, .35); outline-offset: 1px; }
.bkc-hint { color: var(--bkc-muted); font-size: 12.5px; }

/* Popover editor */
.bkc-pop { position: absolute; z-index: 40; width: 300px; max-width: 100%; box-sizing: border-box; padding: 14px; border: 1px solid var(--bkc-line); border-radius: 20px; background: var(--bkc-surface); box-shadow: var(--shadow-lg, 0 24px 60px -12px rgba(29, 27, 24, .25)); animation: bkc-pop .28s var(--bkc-ease); }
.bkc-pop:focus { outline: none; }
.bkc-pop-head { display: flex; align-items: flex-end; gap: 10px; }
.bkc-picker { position: relative; flex: none; width: 58px; height: 58px; border-radius: 15px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(29, 27, 24, .1); cursor: pointer; overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bkc-picker input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); opacity: 0; cursor: pointer; }
.bkc-picker:focus-within { outline: 3px solid var(--accent, #e0583a); outline-offset: 2px; }
.bkc-pop-hex { flex: 1; min-width: 0; }
.bkc-pop-hex .bkc-lab { margin-top: 0; }
.bkc-icon-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--bkc-line-2); border-radius: 11px; background: var(--bkc-surface); transition: border-color .2s; }
.bkc-icon-btn:hover { border-color: var(--bkc-ink); }
.bkc-icon-btn:focus-visible { outline: 3px solid rgba(224, 88, 58, .35); outline-offset: 1px; }
.bkc-err { margin: 6px 0 0; font-size: 12.5px; color: var(--red, #c23b2a); }
.bkc-err:empty { display: none; }
.bkc-pop-cr { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bkc-line); }
.bkc-pop-cr-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; line-height: 1.4; }
.bkc-pop-cr-row .bkc-pair-sample { width: 34px; height: 34px; font-size: 15px; border-radius: 9px; }
.bkc-pop-cr-row.is-fail b { color: var(--red, #c23b2a); }
.bkc-pop-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }

@keyframes bkc-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes bkc-pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }

@media (hover: none) {
  .bkc-move, .bkc-pen { opacity: 1; transform: none; }
  .bkc-hex svg { opacity: .7; }
}

/* Phones: two columns, and the editor becomes a bottom sheet. */
@media (max-width: 520px) {
  .bkc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bkc-swatch { height: 96px; }
  .bkc-move { top: 60px; }
  .bkc-add { min-height: 150px; }
  .bkc-count { margin-left: 0; width: 100%; }
  .bkc-sugg-title { min-width: 0; width: 100%; }
  .bkc-pop { position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; max-height: calc(100vh - 24px); overflow-y: auto; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); animation-name: bkc-sheet; box-shadow: 0 0 0 100vmax rgba(29, 27, 24, .32), var(--shadow-lg, 0 24px 60px -12px rgba(29, 27, 24, .25)); }
  @keyframes bkc-sheet { from { transform: translateY(40px); opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  .bkc *, .bkc-pop { animation: none !important; transition: none !important; }
}

@media print {
  .bkc-tools, .bkc-paste, .bkc-sugg, .bkc-note, .bkc-move, .bkc-pen, .bkc-add-li, .bkc-pop, .bkc-tip { display: none !important; }
  .bkc-tile { break-inside: avoid; box-shadow: none; transform: none !important; }
  .bkc-hex svg { display: none; }
}
