/* Dark-OptNotes — кнопка N слева + окно как маркет, карточки в стиле сайта */

.site-notes-root {
  position: fixed;
  z-index: 10975;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.site-notes-root .site-notes-stack,
.site-notes-root .site-notes-panel {
  pointer-events: auto;
}

.site-notes-stack {
  position: fixed;
  z-index: 10976;
  /* top выставляет JS placeStack ниже соседних левых FAB */
  top: calc(var(--site-header-sticky-offset, 96px) + 52px);
  left: max(10px, env(safe-area-inset-left, 0px) + 10px);
  width: 44px;
}

@media (min-width: 1080px) {
  .site-notes-stack {
    top: calc(var(--site-header-sticky-offset, 96px) + 10px);
    left: max(16px, env(safe-area-inset-left, 0px) + 16px);
  }
}

.site-notes-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: #0f766e;
  color: #fef9c3;
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 3px 3px 0 0 var(--border, #111);
}

.site-notes-fab:hover,
.site-notes-fab:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 0 var(--border, #111);
}

.site-notes-root.is-open .site-notes-fab {
  background: #0d9488;
}

.site-notes-panel {
  position: fixed;
  inset: 0;
  z-index: 11020;
  pointer-events: none;
}

.site-notes-panel.is-open {
  pointer-events: auto;
}

.site-notes-panel[hidden] {
  display: none !important;
}

.site-notes-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(12, 11, 9, 0.62);
  cursor: pointer;
}

.site-notes-sheet {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background: var(--background, #0c0b09);
  color: var(--foreground, #fafafa);
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
  background-image: var(--nb-glow, none);
  background-attachment: fixed;
}

.site-notes-head {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  border-bottom: var(--nb-border-w, 2px) solid var(--border, #111);
  background: var(--card, #141416);
}

.site-notes-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-notes-head-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
}

.site-notes-back,
.site-notes-close {
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--card, #fff);
  color: var(--foreground, #111);
  width: 36px;
  height: 36px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 0 var(--border, #111);
}

.site-notes-toolbar {
  position: relative;
  z-index: 6;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-notes-add-btn,
.site-notes-btn {
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: #facc15;
  color: #111;
  font-weight: 800;
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 0 var(--border, #111);
}

.site-notes-btn.is-ghost {
  background: var(--card, #fff);
}

.site-notes-body {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow: auto;
  padding: 16px 18px 28px;
  -webkit-overflow-scrolling: touch;
}

.site-notes-loading,
.site-notes-empty,
.site-notes-msg {
  margin: 0;
  opacity: 0.8;
}

.site-notes-msg.is-err {
  color: #f87171;
}

.site-notes-msg.is-ok {
  color: #4ade80;
}

.site-notes-intro {
  width: min(720px, 100%);
  margin: 0 0 18px;
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
  opacity: 0.92;
}

.site-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.site-notes-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-width: 0;
  background: var(--card, #fff);
  color: var(--foreground, #111);
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  box-shadow: 2px 2px 0 0 var(--border, #111);
  overflow: hidden;
}

.site-notes-card-media {
  margin: 8px 8px 0;
  aspect-ratio: 16 / 10;
  height: auto;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: #111;
  overflow: hidden;
}

.site-notes-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-notes-card-media.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5f5f5;
  font-weight: 800;
  font-size: 18px;
  opacity: 0.5;
}

.site-notes-card-title {
  margin: 8px 10px 6px;
  min-height: 2.5em;
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.site-notes-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 8px;
  background: #1f1f22;
  border-top: var(--nb-border-w, 2px) solid var(--border, #111);
  min-width: 0;
}

.site-notes-vote,
.site-notes-read {
  box-sizing: border-box;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: #f5f5f5;
  color: #111;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  height: 32px;
  padding: 0 8px;
  cursor: pointer;
  box-shadow: 1px 1px 0 0 var(--border, #111);
  white-space: nowrap;
}

.site-notes-vote {
  flex: 0 0 auto;
  min-width: 44px;
}

.site-notes-vote.is-on {
  background: #facc15;
}

.site-notes-read {
  flex: 1 1 auto;
  min-width: 84px;
  background: #facc15;
}

/* Форма добавления / деталка — колонка как у блога */
.site-notes-form,
.site-notes-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(720px, 100%);
  max-width: 720px;
  margin: 0 auto;
}

.site-notes-form label,
.site-notes-detail-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}

.site-notes-form input,
.site-notes-form textarea,
.site-notes-detail textarea {
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--card, #fff);
  color: var(--foreground, #111);
  padding: 10px 12px;
  font: inherit;
}

.site-notes-form-actions,
.site-notes-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-notes-detail-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.site-notes-detail-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  flex: 0 0 auto;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  overflow: hidden;
  background: #111;
}

.site-notes-detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.site-notes-detail-media.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #f5f5f5;
  opacity: 0.45;
}

.site-notes-detail-meta {
  min-width: 0;
}

.site-notes-detail-meta strong {
  display: block;
  font-family: var(--nb-font, "Space Grotesk", sans-serif);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

.site-notes-detail-meta span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.7;
}

.site-notes-detail-body {
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 16px;
}

.site-notes-share {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-notes-share input {
  flex: 1;
  min-width: 0;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  padding: 8px 10px;
  background: var(--card, #fff);
  color: var(--foreground, #111);
}

.site-notes-comments {
  margin: 8px 0 0;
}

.site-notes-comments .card-comments-toggle {
  width: 100%;
}

.site-notes-comments-panel {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.site-notes-comments-panel[hidden] {
  display: none !important;
}

.site-notes-comments-panel .card-comment-item {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-notes-comments-panel .card-comment-date {
  font-size: 12px;
  opacity: 0.65;
}

body.site-notes-open {
  overflow: hidden;
}

body.site-notes-open .trusted-agg-stack,
body.site-notes-open .site-chat-stack,
body.site-notes-open .site-games-stack,
body.site-notes-open .site-market-stack,
body.site-notes-open .site-bestchange-stack,
body.site-notes-open .site-vod-stack,
body.site-notes-open .teaser-ads-stack,
body.site-notes-open .site-tamadrak-stack,
body.site-notes-open .site-shooter-stack,
body.site-notes-open .site-notes-stack,
body.site-notes-open .site-fab-dock,
body.site-notes-open .site-fab-dock-toggle {
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* edge-tabs / dock */
body.site-fab-edge-tabs .site-notes-fab {
  width: 44px;
}

.site-fab-dock .site-notes-fab {
  width: 100%;
}

/* Лента карточек: 2 в ряд на телефоне, до 3 на планшете, шире — авто-сетка */
@media (max-width: 639px) {
  .site-notes-body {
    padding: 12px 10px 24px;
  }

  .site-notes-grid {
    gap: 8px;
  }

  .site-notes-card-media {
    margin: 6px 6px 0;
  }

  .site-notes-card-title {
    margin: 6px 8px 4px;
    font-size: 13px;
    min-height: 2.35em;
  }

  .site-notes-card-foot {
    flex-wrap: nowrap;
    gap: 3px;
    padding: 5px;
  }

  .site-notes-vote,
  .site-notes-read {
    font-size: 10px;
    height: 28px;
    padding: 0 4px;
    box-shadow: 1px 1px 0 0 var(--border, #111);
    min-width: 0;
  }

  .site-notes-vote {
    flex: 0 0 auto;
    min-width: 34px;
  }

  .site-notes-read {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 640px) and (max-width: 1099px) {
  .site-notes-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .site-notes-card-foot {
    gap: 5px;
    padding: 7px;
  }

  .site-notes-vote,
  .site-notes-read {
    font-size: 11px;
    height: 30px;
    padding: 0 6px;
  }

  .site-notes-read {
    min-width: 0;
  }
}

@media (min-width: 1100px) {
  .site-notes-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 240px));
    justify-content: start;
    gap: 14px;
  }

  .site-notes-card {
    max-width: 240px;
  }
}
