.announcements-shell {
  gap: 8px;
  padding: 10px 0 0;
}

.announcement-heading {
  margin: 10px auto 8px;
  text-align: center;
}

.announcement-heading h1 {
  margin: 0 0 4px;
  color: var(--primary-dark);
}

.announcement-heading p {
  margin: 0;
  color: #444;
}

.announcement-editor {
  margin-bottom: 4px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(#f9fcff, #edf3f8);
  box-shadow: inset 0 1px 0 #ffffff;
}

.announcement-editor h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.announcement-editor input,
.announcement-editor textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: linear-gradient(#ffffff, #f5f9fd);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
}

.announcement-editor input[hidden],
.announcement-editor textarea[hidden],
.announcement-inline-editor input[hidden],
.announcement-inline-editor textarea[hidden] {
  display: none !important;
}

.announcement-editor input:focus,
.announcement-editor textarea:focus {
  outline: none;
  border-color: #5f86a3;
  background: #ffffff;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.1),
    0 0 0 2px rgba(95,134,163,0.15);
}

.announcement-editor textarea {
  height: 145px;
  resize: none;
}

.announcement-content-preview {
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(#f4f8fc, #e7eff6);
  box-shadow: inset 0 1px 0 #ffffff;
  color: #000;
  line-height: 1.5;
  word-break: break-word;
}

.announcement-content-preview em {
  color: #6b7c8c;
  font-style: italic;
}

.announcement-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  overflow: visible;
}

.announcement-editor-submit {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  overflow: visible;
}

.announcement-editor-submit .control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 36px;
  padding: 6px 14px;
  line-height: normal;
  overflow: visible;
}

#announcementCharacterCount {
  color: #6b7c8c;
  font-size: 12px;
}

#announcementCharacterCount.warning {
  color: #c0392b;
  font-weight: bold;
}

.announcement-preview-title {
  margin: 0 0 12px;
  color: var(--primary-dark);
  font-size: 22px;
  font-weight: bold;
}

.announcement-preview-content {
  line-height: 1.55;
}

.announcements-list {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcements-shell {
  padding-bottom: 14px;
}

.announcements-shell:has(.announcements-loading) {
  padding-bottom: 14px;
}

.announcements-loading {
  width: 100%;
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(#f9fcff, #edf3f8);
  color: #55748b;
  text-align: center;
  font-style: italic;
  animation: none;
}

#announcementsPagination {
  margin-top: 12px;
}

#announcementsPagination[hidden] {
  display: none;
  margin-top: 0;
}

.announcement-thread .thread-pagination {
  margin: 10px 0 8px;
}

.announcement-card {
  box-sizing: border-box;
  position: relative;
  padding: 14px 16px;
  gap: 8px;
}

.announcement-locked-card {
  border-color: #5f6a75;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 0 0 1px rgba(58, 68, 78, 0.22);
}

.announcement-card.editing {
  padding: 0;
}

.announcement-inline-editor {
  padding: 16px 18px;
}

.announcement-inline-editor h2 {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 22px;
}

.announcement-inline-editor input,
.announcement-inline-editor textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(#ffffff, #f5f9fd);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  font: inherit;
}

.announcement-inline-editor input:focus,
.announcement-inline-editor textarea:focus {
  outline: none;
  border-color: #5f86a3;
  background: #ffffff;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.1),
    0 0 0 2px rgba(95,134,163,0.15);
}

.announcement-inline-editor textarea {
  height: 130px;
  resize: none;
}

.announcement-inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.announcement-inline-actions .control-btn {
  padding: 6px 14px;
}

.announcement-inline-count {
  color: #6b7c8c;
  font-size: 12px;
}

.announcement-inline-count.warning {
  color: #c0392b;
  font-weight: bold;
}

.announcement-reply-edit .edit-textarea {
  box-sizing: border-box;
  min-height: 96px;
  resize: none;
}

.announcement-reply-form .announcement-content-preview,
.announcement-reply-edit .announcement-content-preview {
  box-sizing: border-box;
  min-height: 0;
  margin: 0;
}

.announcement-reply-edit .comment-form-footer {
  margin-top: 10px;
  padding-bottom: 2px;
  align-items: center;
  overflow: visible;
}

.announcement-reply-edit .comment-form-actions {
  align-items: center;
  gap: 10px;
  overflow: visible;
}

.announcement-reply-edit .comment-form-actions .control-btn {
  box-sizing: border-box;
  min-height: 36px;
  overflow: visible;
  line-height: normal;
  padding: 6px 14px;
}

.announcement-card.linked-target:not(.announcement-deleted),
.announcement-thread .reply.linked-target:not(.announcement-deleted-reply) {
  border-color: #d49a1f;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 0 0 2px rgba(212,154,31,0.12);
}

.announcement-card.announcement-locked-card.linked-target:not(.announcement-deleted) {
  border-color: #5f6a75;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 0 0 1px rgba(58, 68, 78, 0.22),
    0 0 0 3px rgba(212,154,31,0.08);
}

.announcement-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.announcement-card .comment-header {
  align-items: flex-start;
}

.announcement-locked {
  position: absolute;
  top: 8px;
  right: 14px;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #34404b;
  font: inherit;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  line-height: 1;
}

.announcement-card:has(> .announcement-locked) .announcement-header-controls {
  padding-top: 15px;
}

.announcement-deleted {
  border: 2px solid #c0392b;
  opacity: 0.65;
  position: relative;
}

.announcement-deleted-badge {
  position: absolute;
  top: 8px;
  right: 14px;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c0392b;
  font: inherit;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  line-height: 1;
}

.announcement-deleted-reply {
  border: 2px solid #c0392b;
  opacity: 0.65;
  position: relative;
}

.announcement-card:has(> .announcement-deleted-badge) .announcement-header-controls,
.announcement-thread .reply:has(> .announcement-deleted-badge) .announcement-reply-controls {
  padding-top: 15px;
}

.announcement-title {
  margin: 0;
  color: var(--primary-dark);
  font-size: 22px;
  line-height: 1.28;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  white-space: normal;
}

.announcement-card .comment-body {
  padding: 3px 0 7px;
  padding-right: 14px;
  box-sizing: border-box;
  max-height: min(560px, 68dvh);
  overflow-y: auto;
  overflow-x: auto;
  line-height: 1.55;
  flex-grow: 1;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.announcement-content-preview .bbcode-youtube,
.announcement-card .comment-body .bbcode-youtube,
.announcement-thread .reply-body .bbcode-youtube {
  width: 100%;
  max-width: 420px;
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 1000px) {
  .announcement-content-preview .bbcode-youtube,
  .announcement-card .comment-body .bbcode-youtube,
  .announcement-thread .reply-body .bbcode-youtube {
    max-width: min(100%, 420px);
  }
}

.announcement-byline {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.announcement-byline .comment-user {
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.announcement-thread .reply-user {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.announcement-card .comment-actions {
  flex-shrink: 0;
}

.announcement-header-controls,
.announcement-reply-controls {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.announcement-card .comment-avatar,
.announcement-thread .reply-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.announcement-card .comment-username,
.announcement-thread .reply-username {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.announcement-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.announcement-date {
  margin-left: auto;
  color: #6b7c8c;
  font-size: 12px;
}

.announcement-reactions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: bold;
  line-height: normal;
  overflow: visible;
}

.reaction-btn img {
  width: 16px;
  height: 16px;
  opacity: 0.78;
}

.reaction-btn:hover:not(:disabled) img,
.reaction-btn.active img {
  opacity: 1;
}

.reaction-btn span {
  font-size: 15px;
  line-height: 1;
}

.reaction-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.announcement-thread {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.announcement-thread[hidden] {
  display: none;
}

.announcement-thread-actions {
  margin: 8px 0;
}

.announcement-thread .reply {
  margin-bottom: 8px;
  overflow: visible;
}

.announcement-reply-form {
  margin-top: 10px;
  overflow: visible;
}

.announcement-card .no-comments {
  margin-top: 8px;
  padding: 13px 18px;
}

.announcement-reply-count[hidden] {
  display: none;
}

.announcement-reply-count {
  padding: 5px 10px;
  font-size: 14px;
  line-height: 1.15;
}

.bbcode-image {
  max-width: 100%;
}

@media (max-width: 1300px) {
  .box-inner.single-column > .announcement-editor,
  .box-inner.single-column > .announcements-list {
    flex: 0 1 calc(100% - 36px);
    width: calc(100% - 36px);
    margin-left: auto;
    margin-right: auto;
  }

  .announcement-header-controls,
  .announcement-reply-controls {
    justify-content: flex-end;
  }

  .announcement-title-row {
    flex: 1 1 auto;
  }

  .announcement-header-controls,
  .announcement-reply-controls {
    flex: 0 0 auto;
  }

  .announcement-card:has(> .announcement-locked) .announcement-header-controls,
  .announcement-card:has(> .announcement-deleted-badge) .announcement-header-controls,
  .announcement-thread .reply:has(> .announcement-deleted-badge) .announcement-reply-controls {
    padding-top: 15px;
  }
}

@media (max-width: 700px) {
  .announcements-shell {
    box-sizing: border-box;
    padding: 10px 8px 14px;
  }

  .announcement-heading {
    max-width: 330px;
  }

  .announcement-heading h1 {
    font-size: 31px;
    line-height: 1.12;
  }

  .announcement-heading p {
    font-size: 17px;
    line-height: 1.35;
  }

  .box-inner.single-column > .announcement-editor,
  .box-inner.single-column > .announcements-list {
    flex: 0 1 calc(100% - 8px);
    width: calc(100% - 8px);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }

  .announcement-card,
  .announcement-thread .reply {
    width: 100%;
    max-width: 100%;
  }

  .announcement-card .comment-header,
  .announcement-thread .reply-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .announcement-title-row {
    order: 2;
    width: 100%;
  }

  .announcement-header-controls {
    order: 1;
  }

  .announcement-thread .reply-user {
    order: 2;
  }

  .announcement-title {
    font-size: 24px;
    line-height: 1.26;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 2px;
    white-space: normal;
  }

  .announcement-header-controls,
  .announcement-reply-controls {
    align-self: stretch;
    flex: 0 1 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
  }

  .announcement-reply-controls {
    order: 1;
  }

  .announcement-card .comment-actions .nav-item,
  .announcement-thread .reply-actions .nav-item {
    flex: 0 0 auto;
  }

  .announcement-locked,
  .announcement-deleted-badge {
    align-self: auto;
    order: initial;
  }

  .announcement-card .comment-body,
  .announcement-thread .reply-body {
    max-height: min(440px, 62dvh);
    overflow-y: auto;
    overflow-x: auto;
  }

  .announcement-card .comment-body {
    padding-right: 6px;
  }

  .announcement-editor-footer {
    align-items: flex-end;
    flex-direction: column;
  }

  .announcement-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .announcements-shell {
    padding-left: 6px;
    padding-right: 6px;
  }

  .announcement-heading {
    max-width: 320px;
  }

  .box-inner.single-column > .announcement-editor,
  .box-inner.single-column > .announcements-list {
    flex-basis: calc(100% - 4px);
    width: calc(100% - 4px);
    max-width: 340px;
  }

  .announcement-title {
    font-size: 22px;
  }

  .announcement-card,
  .announcement-thread .reply {
    padding-left: 12px;
    padding-right: 12px;
  }

  .announcement-header-controls,
  .announcement-reply-controls {
    gap: 7px;
  }
}
