.topbar.topbar-with-notification {
  align-items: flex-start;
  flex-direction: row;
}

.topbar-with-notification > div {
  min-width: 0;
}

.notification-bell {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 32px;
  min-height: 0;
  display: inline-grid;
  place-items: center;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.notification-bell svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-bell:hover:not(:disabled),
.notification-bell:focus-visible {
  background: rgba(20, 35, 28, 0.06);
  box-shadow: none;
  transform: none;
}

.notification-bell:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: none;
}

.notification-bell-dot {
  position: absolute;
  top: 9px;
  right: 6px;
  width: 8px;
  height: 8px;
  display: none;
  border: 2px solid var(--safe-bg);
  border-radius: 999px;
  background: #e34848;
}

.notification-bell.has-unread .notification-bell-dot {
  display: block;
}

body.notification-open {
  overflow: hidden;
}

html[data-theme^="glass-"] .topbar .notification-bell,
html[data-theme^="glass-"] .topbar .notification-bell:hover:not(:disabled),
html[data-theme^="glass-"] .topbar .notification-bell:focus-visible,
html[data-theme^="glass-"] .topbar .notification-bell:active:not(:disabled) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.notification-backdrop {
  position: fixed;
  z-index: 1472;
  inset: 0;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 0 4vw;
  background: transparent;
  overscroll-behavior: none;
  touch-action: pan-y;
  transition: none;
}

.notification-panel {
  width: min(840px, 92vw);
  height: min(650px, calc(100dvh - var(--modal-safe-top-gap) - 88px));
  max-height: calc(100dvh - var(--modal-safe-top-gap) - 88px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #f8faf9;
  box-shadow: 0 28px 86px rgba(4, 12, 8, 0.28);
  color: #17231d;
  overscroll-behavior: contain;
  touch-action: pan-y;
  backface-visibility: hidden;
  transform: translate3d(0, 100%, 0);
  transition: transform 350ms cubic-bezier(0.34, 0, 0.2, 1);
  will-change: transform;
}

.notification-backdrop.is-open .notification-panel {
  transform: translate3d(0, 0, 0);
}

.notification-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
}

.notification-header p,
.notification-header h2 {
  margin: 0;
}

.notification-header p {
  color: #1f7a5a;
  font-size: 11px;
  font-weight: 820;
}

.notification-header h2 {
  color: #14231c;
  font-size: 20px;
  line-height: 1.1;
}

.notification-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-close,
.notification-mark-read {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: #14231c;
  font-weight: 760;
  box-shadow: none;
}

.notification-close:disabled,
.notification-mark-read:disabled {
  cursor: default;
  opacity: 0.46;
}

.notification-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.notification-content::-webkit-scrollbar {
  display: none;
}

.notification-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: #fff;
}

.notification-swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  touch-action: pan-y;
}

.notification-delete-action {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 0;
  width: 72px;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #fa5151;
  color: #fff;
  box-shadow: none;
  transform: none;
}

.notification-delete-label {
  display: block;
  color: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.notification-delete-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.notification-delete-action:hover:not(:disabled),
.notification-delete-action:focus-visible,
.notification-delete-action:active:not(:disabled) {
  background: #e64340;
  box-shadow: none;
  transform: none;
}

.notification-item {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 82px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 10px 14px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  color: #17231d;
  text-align: left;
  white-space: normal;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease, background-color 120ms ease;
  will-change: transform;
}

.notification-item::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 76px;
  height: 1px;
  background: rgba(23, 42, 53, 0.09);
  transform: scaleY(0.5);
  transform-origin: 50% 100%;
}

.notification-swipe-row:last-child .notification-item::after {
  display: none;
}

.notification-swipe-row.is-delete-open .notification-item {
  transform: translate3d(-72px, 0, 0);
}

.notification-swipe-row.is-swiping .notification-item {
  transition: none;
}

.notification-swipe-row.is-deleting {
  opacity: 0.68;
}

.notification-swipe-row.is-highlighted .notification-item {
  background: rgba(31, 122, 90, 0.08);
  box-shadow: inset 3px 0 0 var(--primary);
}

.notification-item:hover,
.notification-item:focus-visible {
  background: #f5f6f6;
  box-shadow: none;
}

.notification-item:focus-visible {
  outline: 2px solid rgba(40, 120, 138, 0.34);
  outline-offset: -2px;
}

.notification-item:active:not(:disabled) {
  background: #e9ebeb;
  box-shadow: none;
}

.notification-item-icon-wrap {
  position: relative;
  width: 50px;
  height: 50px;
  align-self: center;
}

.notification-item-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: rgba(75, 159, 178, 0.12);
  color: #2f7280;
}

.notification-item-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-item--reply .notification-item-icon {
  background: rgba(126, 111, 196, 0.12);
  color: #6f62b6;
}

.notification-item--like .notification-item-icon {
  background: rgba(216, 134, 181, 0.14);
  color: #b85d91;
}

.notification-item--moderation .notification-item-icon {
  background: rgba(212, 170, 102, 0.16);
  color: #956b2e;
}

.notification-item-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
}

.notification-item-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-item-heading strong {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: #172a35;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-heading time {
  flex: 0 0 auto;
  align-self: flex-start;
  color: #a0aaa5;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  white-space: nowrap;
}

.notification-item-unread {
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 2;
  width: 10px;
  height: 10px;
  min-width: 0;
  display: block;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0;
  background: #fa5151;
}

.notification-item-copy {
  display: block;
  overflow: hidden;
  color: #8a9690;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-actor {
  color: inherit;
  font-weight: 400;
}

.notification-item.is-unread {
  box-shadow: none;
}

.notification-loading,
.notification-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #66746d;
  font-size: 14px;
  text-align: center;
}

.community-comment-item.is-notification-target .community-comment-bubble {
  border-color: rgba(227, 72, 72, 0.38);
  background: #fff8f7;
  box-shadow: 0 0 0 3px rgba(227, 72, 72, 0.1);
}

html[data-theme^="glass-"] .notification-panel {
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(245, 251, 255, 0.58)),
    radial-gradient(120% 80% at 4% 0%, var(--glass-panel-glow-a), rgba(255, 255, 255, 0) 58%),
    radial-gradient(110% 90% at 100% 0%, var(--glass-panel-glow-b), rgba(255, 255, 255, 0) 58%);
  box-shadow: 0 34px 100px rgba(69, 88, 105, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(30px) saturate(1.28);
  backdrop-filter: blur(30px) saturate(1.28);
}

html[data-theme^="glass-"] .notification-backdrop.is-open {
  background: rgba(230, 241, 246, 0.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);
}

@media (prefers-color-scheme: dark) {
  html[data-theme^="glass-"] .notification-panel {
    border-color: rgba(255, 255, 255, 0.18);
    background:
      linear-gradient(145deg, rgba(29, 41, 55, 0.84), rgba(16, 25, 36, 0.68)),
      radial-gradient(120% 80% at 4% 0%, var(--glass-panel-glow-a), rgba(16, 25, 36, 0) 58%),
      radial-gradient(110% 90% at 100% 0%, var(--glass-panel-glow-b), rgba(16, 25, 36, 0) 58%);
    box-shadow: 0 36px 104px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.13);
  }

  html[data-theme^="glass-"] .notification-backdrop.is-open {
    background: rgba(8, 13, 19, 0.12);
  }

  html[data-theme^="glass-"] .notification-header {
    border-bottom-color: rgba(255, 255, 255, 0.12);
    background:
      linear-gradient(145deg, rgba(25, 38, 53, 0.88), rgba(11, 20, 33, 0.76)),
      radial-gradient(110% 95% at 100% 0%, rgba(111, 207, 226, 0.1), rgba(11, 20, 33, 0) 58%);
  }

  html[data-theme^="glass-"] .notification-header p {
    color: var(--primary);
  }

  html[data-theme^="glass-"] .notification-header h2 {
    color: var(--ink);
  }

  html[data-theme^="glass-"] .notification-close,
  html[data-theme^="glass-"] .notification-mark-read {
    border-color: rgba(255, 255, 255, 0.16);
    background:
      linear-gradient(145deg, rgba(39, 54, 70, 0.84), rgba(19, 30, 43, 0.64)),
      radial-gradient(110% 100% at 100% 0%, rgba(111, 207, 226, 0.12), rgba(19, 30, 43, 0) 58%);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  html[data-theme^="glass-"] .notification-close:hover:not(:disabled),
  html[data-theme^="glass-"] .notification-close:focus-visible,
  html[data-theme^="glass-"] .notification-mark-read:hover:not(:disabled),
  html[data-theme^="glass-"] .notification-mark-read:focus-visible {
    border-color: rgba(189, 239, 255, 0.28);
    background:
      linear-gradient(145deg, rgba(48, 65, 82, 0.88), rgba(24, 36, 50, 0.72)),
      radial-gradient(110% 100% at 100% 0%, rgba(111, 207, 226, 0.18), rgba(24, 36, 50, 0) 58%);
  }

  html[data-theme^="glass-"] .notification-item {
    border-color: transparent;
    background: #111e2b;
    color: var(--ink);
    box-shadow: none;
  }

  html[data-theme^="glass-"] .notification-item:hover,
  html[data-theme^="glass-"] .notification-item:focus-visible {
    border-color: transparent;
    background: #1a2a39;
    box-shadow: none;
  }

  html[data-theme^="glass-"] .notification-item:active:not(:disabled) {
    background: #223442;
    box-shadow: none;
  }

  html[data-theme^="glass-"] .notification-list {
    background: #111e2b;
  }

  html[data-theme^="glass-"] .notification-item::after {
    background: rgba(214, 229, 237, 0.14);
  }

  html[data-theme^="glass-"] .notification-item-unread {
    border-color: #111e2b;
  }

  html[data-theme^="glass-"] .notification-item-copy,
  html[data-theme^="glass-"] .notification-item-heading time,
  html[data-theme^="glass-"] .notification-loading,
  html[data-theme^="glass-"] .notification-empty {
    color: rgba(214, 229, 237, 0.7);
  }

  html[data-theme^="glass-"] .notification-item-heading strong,
  html[data-theme^="glass-"] .notification-item-actor {
    color: var(--ink);
  }

  html[data-theme^="glass-"] .community-comment-item.is-notification-target .community-comment-bubble {
    border-color: rgba(255, 145, 163, 0.38);
    background: rgba(255, 145, 163, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 145, 163, 0.08);
  }
}

@media (max-width: 640px) {
  .topbar.topbar-with-notification {
    align-items: flex-start;
    flex-direction: row;
  }

  .notification-backdrop {
    align-items: end;
    padding: 0;
  }

  .notification-bell {
    width: 36px;
    height: 32px;
  }

  .notification-panel {
    width: 100vw;
    height: calc(100dvh - var(--modal-safe-top-gap) - 78px);
    max-height: calc(100dvh - var(--modal-safe-top-gap) - 78px);
    border-right: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notification-backdrop,
  .notification-panel {
    transition: none;
  }
}
