/* =========================================================
   МАСКА ПРОФИЛЯ (скрипт mask.js)
   окно как личная страница: голубой фон с пупыркой, светлый лист,
   блоки с ярлыками, кнопки-пилюли
   ========================================================= */

/* код маски в посте никогда не видно */
.cbmask { display: none !important; }

/* пока маска не наложена — профиль поста не мигает настоящим;
   если скрипт не загрузился, через 3 секунды профиль покажется сам */
.post:has(.cbmask):not(.cb-mk-done) .post-author { animation: cbMkWait 3s steps(1) both; }
@keyframes cbMkWait { from { visibility: hidden; } to { visibility: visible; } }

/* кнопка в панели над полем ответа */
#button-mask { position: relative; }
#button-mask::before { content: "\f8f5"; }
#button-mask.is-on::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  background: #a40e41;
  border-radius: 50%;
}

/* ---------- плашечка «в маске: …» над полем ответа ---------- */
.cb-mk-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  padding: 5px 6px 5px 5px;
  background: #f1f1f0;
  border: 1px dashed rgba(14, 0, 0, .22);
  border-radius: 3px;
  font: 400 10px/1.3 var(--font1);
  color: #0e0000;
  text-align: left;
}
.cb-mk-chip img {
  width: 22px;
  height: 22px;
  margin: 0;
  object-fit: cover;
  border: 0;
}
.cb-mk-chip span { margin-right: auto; }
.cb-mk-chip b { font-weight: 590; }
.cb-mk-chip em { margin-left: 8px; font-style: normal; color: #767676; }
.cb-mk-chip button {
  margin: 0;
  padding: 3px 9px;
  background: transparent;
  border: 1px solid rgba(36, 25, 21, .48);
  border-radius: 39px;
  box-shadow: none;
  font: 400 9px/normal var(--font1);
  text-transform: none;
  color: #0e0000;
  cursor: pointer;
}
.cb-mk-chip button:hover { background: #e9edf0; }

/* =========================================================
   ОКНО
   ========================================================= */
html.cb-mk-lock { overflow: hidden; }

.cb-mk {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  padding: 28px 16px;
  overflow-y: auto;
  background: rgba(30, 15, 17, .32);
  font: 400 11px/1.4 var(--font1);
  text-align: left;
  color: #0e0000;
}
.cb-mk.is-open { display: flex; }
.cb-mk * { box-sizing: border-box; }

.cb-mk__win {
  width: 100%;
  max-width: 900px;
  margin: auto;
  padding: 12px;
  background: #becad4 var(--lp-bubbles);
  border-radius: 4px;
  box-shadow: 0 10px 34px rgba(30, 15, 17, .28);
}
.cb-mk__sheet {
  background: #f6f5f4;
  border-radius: 3px;
  box-shadow: 1px 1px 1px 0 rgba(0, 0, 0, .1);
}

.cb-mk__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px 18px;
  border-bottom: 1px dashed #dcd2d4;
  font: 400 12px/1 var(--font1);
}
.cb-mk .cb-mk__x {
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(36, 25, 21, .48);
  border-radius: 39px;
  box-shadow: none;
  font: 400 13px/1 var(--font1);
  color: #0e0000;
  cursor: pointer;
}
.cb-mk .cb-mk__x:hover { background: #e9edf0; }

.cb-mk__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 22px;
  align-items: start;
  padding: 18px 18px 6px;
}

/* ---------- блоки с ярлыками ---------- */
.cb-mk__block {
  position: relative;
  margin: 0 0 18px;
  padding-top: 14px;
}
.cb-mk__label {
  position: absolute;
  top: 0;
  left: 9px;
  z-index: 2;
  padding: 4px 10px;
  background: #e6d7da;
  filter: drop-shadow(1px 1px .5px rgba(0, 0, 0, .1));
  font: 400 10px/normal var(--font1);
  color: #0e0000;
}
/* точка у ярлыка — в блоке что-то поменяно маской */
.cb-mk__block.is-changed .cb-mk__label::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 0 1px 6px;
  vertical-align: middle;
  background: #a40e41;
  border-radius: 50%;
}
.cb-mk__box {
  position: relative;
  padding: 22px 12px 12px;
  background: #f1f1f0;
  filter: drop-shadow(1px 1px .5px rgba(0, 0, 0, .1));
}
.cb-mk__note { flex-basis: 100%; margin: 4px 0 0; font-size: 9px; color: #767676; }

/* ---------- ник, статус, аватар ---------- */
.cb-mk__who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.cb-mk__who .is-wide { grid-column: 1 / -1; }
.cb-mk__who label,
.cb-mk__drawer label { display: block; font-size: 9px; color: #646464; }
.cb-mk__who input,
.cb-mk__drawer input {
  display: block;
  width: 100%;
  height: 26px;
  margin: 3px 0 0;
  padding: 0 10px;
  background: #fff;
  border: 1px dashed rgba(14, 0, 0, .22);
  border-radius: 3px;
  box-shadow: none;
  font: 400 11px/1 var(--font1);
  color: #0e0000;
  outline: none;
}
.cb-mk__who input:focus,
.cb-mk__drawer input:focus { border-style: solid; border-color: #becad4; }
.cb-mk__who input.is-bad { border-color: #a40e41; }
.cb-mk input::placeholder,
.cb-mk textarea::placeholder { color: #a8a2a3; }

/* ---------- лз ---------- */
.cb-mk__tools { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.cb-mk__sep { width: 6px; }
.cb-mk__count { margin-left: auto; font-size: 9px; color: #767676; }
.cb-mk__count.is-over { color: #a40e41; }
.cb-mk .cb-mk__lz textarea {
  display: block;
  width: 100%;
  min-height: 70px;
  margin: 0;
  padding: 9px 11px;
  overflow: hidden;
  resize: none;
  background: #fff;
  border: 1px dashed rgba(14, 0, 0, .22);
  border-radius: 3px;
  box-shadow: none;
  font: 400 11px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: #0e0000;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}
.cb-mk .cb-mk__lz textarea:focus { border-style: solid; border-color: #becad4; }

/* ---------- кнопки-пилюли ---------- */
.cb-mk__tools button,
.cb-mk__drawer-btns button,
.cb-mk__foot button {
  margin: 0;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(36, 25, 21, .48);
  border-radius: 39px;
  box-shadow: none;
  font: 400 9px/normal var(--font1);
  text-transform: none;
  color: #0e0000;
  cursor: pointer;
  transition: background .15s;
}
.cb-mk__tools button:hover,
.cb-mk__drawer-btns button:hover,
.cb-mk__foot button:hover { background: #e9edf0; }
.cb-mk__tools .cb-mk__key { min-width: 24px; height: 21px; padding: 0 7px; }
.cb-mk__tools .is-b { font-weight: 700; }
.cb-mk__tools .is-i { font-style: italic; }
.cb-mk__tools .is-u { text-decoration: underline; }
.cb-mk__tools .is-s { text-decoration: line-through; }
.cb-mk__key[data-ic]::before { font: 400 8px/1 var(--fa); }
.cb-mk__key[data-ic="link"]::before { content: "\f0c1"; }
.cb-mk__key[data-ic="br"]::before { content: "\f1dd"; }
.cb-mk button:focus-visible,
.cb-mk input:focus-visible { outline: 2px solid #8fa3b4; outline-offset: 2px; }

/* ---------- плитки с личной страницы ---------- */
.cb-mk__tiles {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  max-height: 168px;
  overflow-y: auto;
}
[data-box="plate"].cb-mk__tiles { max-height: 152px; }
[data-box="icon"].cb-mk__tiles { max-height: 100px; }
.cb-mk__tiles::-webkit-scrollbar { width: 3px; }
.cb-mk__tiles::-webkit-scrollbar-track { background: #e9e9e9; }
.cb-mk__tiles::-webkit-scrollbar-thumb { background: #becad4; }
@supports (-moz-appearance: none) {
  .cb-mk__tiles { scrollbar-width: thin; scrollbar-color: #becad4 #e9e9e9; }
}

.cb-mk .cb-mk__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #e6d7da;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font: inherit;
  color: #0e0000;
  cursor: pointer;
  outline: 1px solid transparent;
  outline-offset: 2px;
  transition: outline-color .15s;
}
.cb-mk .cb-mk__tile:hover { outline-color: rgba(36, 25, 21, .3); }
.cb-mk .cb-mk__tile.is-on { outline: 2px solid #8fa3b4; }
.cb-mk .cb-mk__tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: cover;
}
/* «сейчас стоит в профиле» — уголок */
.cb-mk .cb-mk__tile.is-cur::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border: 6px solid transparent;
  border-top-color: #a40e41;
  border-right-color: #a40e41;
}

/* «как в профиле» и «без …» — пунктирные */
.cb-mk .cb-mk__mode {
  align-items: center;
  width: 92px;
  height: 50px;
  padding: 0 6px;
  background: transparent;
  border: 1px dashed rgba(14, 0, 0, .25);
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  color: #767676;
}
.cb-mk .cb-mk__mode.is-on { color: #0e0000; background: #f6f5f4; }
[data-box="plate"] .cb-mk__mode { height: 42px; }
[data-box="icon"] .cb-mk__mode { width: auto; height: 25px; padding: 0 9px; border-radius: 3px; }

.cb-mk .cb-mk__tile--header { width: 223px; height: 50px; }
.cb-mk .cb-mk__tile--plate { width: 223px; height: 42px; gap: 3px; padding-left: 28.5px; }
.cb-mk .cb-mk__tile--plate span {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 2px 6px;
  overflow: hidden;
  background: #f6f5f4;
  filter: drop-shadow(1px 1px .95px rgba(0, 0, 0, .32));
  font: 300 10px/normal var(--font1);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cb-mk .cb-mk__tile--plate span + span { font-size: 8px; }
.cb-mk .cb-mk__tile--icon {
  align-items: center;
  width: 25px;
  height: 25px;
  background: #f6f5f4;
  border: .9px solid #e4e4e4;
  border-radius: 3px;
  box-shadow: inset 0 1.8px 2.6px rgba(0, 0, 0, .1);
  font-size: 13px;
  line-height: 1;
}
.cb-mk .cb-mk__tile--icon img { position: static; width: 14px; height: 14px; object-fit: contain; }
.cb-mk .cb-mk__tile--icon i { font-style: normal; }

/* текст плашки */
.cb-mk__drawer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 10px 0 0;
  padding: 10px 12px 12px;
  border: 1px dashed rgba(14, 0, 0, .22);
  border-radius: 3px;
}
.cb-mk__drawer-btns { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

/* ---------- правая колонка ---------- */
.cb-mk__side { position: sticky; top: 0; }
.cb-mk__prev {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
  padding: 10px 0 14px;
  background: #f1f1f0;
  filter: drop-shadow(1px 1px .5px rgba(0, 0, 0, .1));
}
.cb-mk__prev a { pointer-events: none; }
.cb-mk .cb-lpa-btn { display: none !important; }
.punbb .cb-mk .cb-mk__post {
  position: relative;
  display: block;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.punbb .cb-mk .cb-mk__post .post-author { margin: 16px auto 0; }

/* мои маски — сетка квадратных аватарок */
.cb-mk__list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 236px; overflow-y: auto; }
.cb-mk__saved-it { position: relative; width: 52px; }
.cb-mk .cb-mk__saved-it > button:first-child {
  display: block;
  width: 52px;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  font: inherit;
  text-align: center;
  color: #0e0000;
  cursor: pointer;
}
.cb-mk__saved-it img,
.cb-mk__saved-it i {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0;
  object-fit: cover;
  background: #e6d7da;
  outline: 1px solid transparent;
  outline-offset: 2px;
  transition: outline-color .15s;
}
.cb-mk__saved-it:hover img,
.cb-mk__saved-it:hover i { outline-color: rgba(36, 25, 21, .3); }
.cb-mk__saved-it.is-on img,
.cb-mk__saved-it.is-on i { outline: 2px solid #8fa3b4; }
.cb-mk__saved-it span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 8.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cb-mk .cb-mk__del {
  position: absolute;
  top: -5px;
  right: -5px;
  display: none;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  background: #f6f5f4;
  border: 1px solid rgba(36, 25, 21, .48);
  border-radius: 50%;
  box-shadow: none;
  font: 400 10px/1 var(--font1);
  color: #0e0000;
  cursor: pointer;
}
.cb-mk__saved-it:hover .cb-mk__del,
.cb-mk .cb-mk__del:focus-visible { display: block; }
.cb-mk .cb-mk__del:hover { background: #e59eb4; }

/* ---------- низ окна ---------- */
.cb-mk__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 14px;
  border-top: 1px dashed #dcd2d4;
}
.cb-mk__foot .is-main { background: #e6d7da; }
.cb-mk__foot .is-main:hover { background: #e59eb4; }
.cb-mk__status { margin-right: auto; font-size: 10px; color: #646464; }
.cb-mk__status.is-err { color: #a40e41; }

/* «носить в этой теме всегда» — переключатель-пилюля */
.cb-mk__pin { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; color: #3d3d3d; cursor: pointer; }
.cb-mk__pin input {
  position: relative;
  width: 26px;
  height: 14px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid rgba(36, 25, 21, .48);
  border-radius: 39px;
  cursor: pointer;
}
.cb-mk__pin input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: #becad4;
  border-radius: 50%;
  transition: transform .15s;
}
.cb-mk__pin input:checked { background: #e6d7da; }
.cb-mk__pin input:checked::after { background: #a40e41; transform: translateX(12px); }
.cb-mk__pin.is-off { opacity: .4; cursor: not-allowed; }

/* ---------- узкий экран ---------- */
@media (max-width: 760px) {
  .cb-mk { padding: 10px 6px; }
  .cb-mk__grid { grid-template-columns: 1fr; padding: 16px 12px 4px; }
  .cb-mk__side { position: static; order: -1; }
  .cb-mk__who,
  .cb-mk__drawer { grid-template-columns: 1fr; }
  .cb-mk .cb-mk__tile--header,
  .cb-mk .cb-mk__tile--plate { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-mk * { transition: none !important; }
}
