/* Стили виджета «colornames» — подключаются только на страницах с ним */
.cn { margin: 24px 0; }
.cn [hidden] { display: none !important; }
.cn__bar {
  position: sticky; top: var(--header-h); z-index: 5;
  margin: 0 -8px 8px; padding: 12px 8px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.cn__search { position: relative; display: flex; align-items: center; }
.cn__search-ico { position: absolute; left: 16px; display: grid; color: var(--muted); pointer-events: none; }
.cn__search-ico svg { width: 20px; height: 20px; }
.cn__input {
  width: 100%; padding: 14px 44px 14px 48px; font: inherit; color: var(--text-strong);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 999px;
}
.cn__input::placeholder { color: var(--muted); }
.cn__input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.cn__input::-webkit-search-cancel-button { display: none; }
.cn__clear {
  position: absolute; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  font-size: 20px; line-height: 1; color: var(--muted); background: var(--surface-2);
}
.cn__nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cn__chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px;
  border-radius: 999px; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); text-decoration: none;
}
.cn__chip:hover { border-color: var(--border-2); color: var(--text-strong); }
.cn__dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.cn__count { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.cn__bar + .cn__near, .cn__bar + .cn__near + [data-cn-groups] > .cn__group:first-child { margin-top: 6px; }
.cn__group { margin-top: 18px; scroll-margin-top: calc(var(--header-h) + 150px); }
.cn__group-title { margin: 0 0 12px; font-size: 21px; }
.cn__group-title span { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.cn__grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cn__card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  content-visibility: auto; contain-intrinsic-size: auto 120px;
}
.cn__card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.cn__card:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.cn__sw { display: block; height: 64px; box-shadow: inset 0 -1px 0 rgba(128,128,128,.25); }
.cn__meta { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px 11px; min-width: 0; }
.cn__name { font-size: 14px; font-weight: 600; color: var(--text-strong); line-height: 1.3; overflow-wrap: anywhere; }
.cn__hex { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cn__near { margin-top: 18px; }
.cn__near-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.cn__near-sw { width: 56px; height: 56px; flex: none; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.cn__near-title { margin: 0; font-size: 20px; }
.cn__near-lead { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.cn__empty { margin: 24px 0; padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius); }
.cn-lock { overflow: hidden; }
.cn__sheet { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.cn__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .18s ease; }
.cn__panel {
  position: relative; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--border-2);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  transform: translateY(12px) scale(.98); opacity: 0; transition: transform .18s ease, opacity .18s ease;
}
.cn__sheet.is-open .cn__backdrop { opacity: 1; }
.cn__sheet.is-open .cn__panel { transform: none; opacity: 1; }
.cn__p-sw { position: relative; display: flex; align-items: flex-end; min-height: 150px; padding: 18px 20px; }
.cn__p-title b { display: block; font-size: 26px; line-height: 1.2; }
.cn__p-title span { font-size: 14px; opacity: .8; }
.cn__p-close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  font-size: 22px; line-height: 1; color: inherit; background: rgba(128,128,128,.25);
}
.cn__p-body { padding: 16px 18px 20px; }
.cn__p-note { margin: 0 0 14px; padding: 10px 12px; font-size: 14px; line-height: 1.55; border-radius: 10px; background: var(--bg-2); color: var(--text); }
.cn__codes { display: grid; gap: 8px; }
.cn__code {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--border);
}
.cn__code:hover { border-color: var(--green); }
.cn__code span { font-size: 12px; font-weight: 700; color: var(--muted); }
.cn__code b { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text-strong); overflow-wrap: anywhere; }
.cn__code i { font-style: normal; font-size: 12px; color: var(--green); }
.cn__p-sub { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }
.cn__similar { display: flex; flex-wrap: wrap; gap: 6px; }
.cn__sim {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; font-size: 13px;
  border-radius: 999px; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
}
.cn__sim span { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.cn__sim:hover { border-color: var(--border-2); color: var(--text-strong); }
.cn__p-link { width: 100%; margin-top: 16px; }
@media (max-width: 720px) {
  .cn__bar { margin: 0 -16px 8px; padding: 10px 16px 8px; }
  .cn__nav {
    flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 4px;
    scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .cn__nav::-webkit-scrollbar { display: none; }
  .cn__chip { flex: none; scroll-snap-align: start; }
  .cn__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cn__sw { height: 56px; }
  .cn__group-title { font-size: 19px; }
  .cn__group { scroll-margin-top: calc(var(--header-h) + 130px); }
  .cn__sheet { place-items: end stretch; }
  .cn__panel {
    width: 100%; max-height: 88dvh; border-radius: 20px 20px 0 0; border-bottom: 0;
    transform: translateY(100%); opacity: 1;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cn__p-sw { min-height: 120px; }
  .cn__p-sw::before {
    content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px;
    margin-left: -20px; border-radius: 2px; background: currentColor; opacity: .35;
  }
}
@media (min-width: 1100px) {
  .cn__grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .cn__card, .cn__panel, .cn__backdrop { transition: none; }
}
