.card-interactions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.comment-button {
  appearance: none;
  border: 1px solid rgba(24, 29, 38, 0.12);
  border-radius: 999px;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #555d69;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.comment-button:hover,
.comment-button:focus-visible {
  background: rgba(246, 248, 252, 0.98);
  border-color: rgba(0, 102, 204, 0.18);
  color: #153d6f;
}

.comment-button:active {
  background: rgba(239, 244, 250, 0.98);
}

.comment-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

.comment-button__icon {
  font-size: 0.95rem;
  line-height: 1;
}

.comments-modal[hidden] {
  display: none;
}

.comments-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.comments-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: blur(18px);
}

.comments-modal__panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  max-height: min(760px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(24, 29, 38, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.comments-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(24, 29, 38, 0.08);
  background: rgba(255, 255, 255, 0.96);
  flex: 0 0 auto;
}

.comments-modal__title {
  min-width: 0;
}

.comments-modal__eyebrow,
.comments-modal__count {
  margin: 0;
  color: #6f7784;
  font-size: 0.82rem;
  line-height: 1.4;
}

.comments-modal__eyebrow {
  max-width: 44ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comments-modal__header h2 {
  margin: 4px 0;
  color: #1d1d1f;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.comments-modal__close {
  appearance: none;
  border: 1px solid rgba(24, 29, 38, 0.1);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  background: rgba(246, 248, 252, 0.94);
  color: #3f4652;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.comments-list {
  display: grid;
  gap: 12px;
  min-height: 72px;
  max-height: 280px;
  overflow: auto;
  padding: 14px 22px 10px;
}

.comments-empty {
  margin: 14px 0;
  color: #7a8290;
  font-size: 0.94rem;
}

.comments-item {
  border: 1px solid rgba(24, 29, 38, 0.08);
  border-radius: 16px;
  background: rgba(248, 250, 253, 0.82);
  padding: 12px 14px;
}

.comments-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.4;
}

.comments-item__meta strong {
  color: #1f2937;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.comments-item p {
  margin: 8px 0 0;
  color: #303640;
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comments-composer {
  padding: 12px 22px 18px;
  border-top: 1px solid rgba(24, 29, 38, 0.08);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  flex: 0 0 auto;
}

.comments-auth-state {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #626b78;
  font-size: 0.9rem;
}

.comments-auth-state button {
  appearance: none;
  font: inherit;
  cursor: pointer;
}

.comments-account-open {
  border-radius: 999px;
  border: 1px solid rgba(24, 29, 38, 0.1);
  background: rgba(255, 255, 255, 0.86);
  color: #2f3947;
  padding: 7px 12px;
}

.comments-form {
  display: grid;
  gap: 8px;
}

.comments-form__label {
  color: #48515e;
  font-size: 0.84rem;
  font-weight: 600;
}

.comments-form__input {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid rgba(24, 29, 38, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: #1d1d1f;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 12px 14px;
  outline: none;
}

.comments-form__input:focus {
  border-color: rgba(0, 102, 204, 0.28);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.comments-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comments-form__hint {
  color: #7a8290;
  font-size: 0.82rem;
}

.comments-form__submit {
  appearance: none;
  border: 1px solid rgba(24, 29, 38, 0.12);
  border-radius: 999px;
  background: #1d1d1f;
  color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1;
  padding: 11px 18px;
  cursor: pointer;
  min-height: 44px;
}

.comments-status {
  min-height: 1.35em;
  margin: 10px 0 0;
  color: #6f7784;
  font-size: 0.88rem;
  line-height: 1.4;
}

.comments-status[data-tone="error"] {
  color: #a33a3a;
}

.comments-status[data-tone="success"] {
  color: #256f49;
}

body.comments-modal-open,
body.auth-modal-open,
body.profile-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .card-interactions {
    margin-left: 0;
    align-self: flex-end;
  }

  .comment-button {
    min-height: 44px;
  }

  .comments-modal {
    padding: 0;
    place-items: stretch;
  }

  .comments-modal__backdrop {
    background: rgba(245, 245, 247, 0.92);
  }

  .comments-modal__panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .comments-modal__header {
    position: sticky;
    top: 0;
    z-index: 3;
    align-items: center;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  }

  .comments-modal__header h2 {
    margin: 2px 0;
    font-size: 1.12rem;
  }

  .comments-modal__eyebrow {
    max-width: calc(100vw - 96px);
    font-size: 0.72rem;
  }

  .comments-modal__count {
    font-size: 0.78rem;
  }

  .comments-modal__close {
    width: 44px;
    height: 44px;
  }

  .comments-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 10px;
    padding: 12px 16px 16px;
  }

  .comments-empty {
    margin: 8px 0;
    font-size: 0.9rem;
  }

  .comments-item {
    border-radius: 14px;
    padding: 12px 14px;
  }

  .comments-item__meta {
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
  }

  .comments-item__meta time {
    flex: 0 0 auto;
  }

  .comments-item p {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .comments-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .comments-auth-state {
    margin-bottom: 8px;
    font-size: 0.82rem;
  }

  .comments-account-open {
    border: 0;
    background: transparent;
    color: #245ea8;
    padding: 4px 0 4px 8px;
  }

  .comments-form {
    gap: 7px;
  }

  .comments-form__label {
    display: none;
  }

  .comments-form__input {
    min-height: 88px;
    max-height: 28vh;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.94rem;
  }

  .comments-form__footer {
    gap: 10px;
  }

  .comments-form__submit {
    min-height: 40px;
    padding: 10px 16px;
  }

  .comments-status {
    min-height: 1.2em;
    margin-top: 7px;
    font-size: 0.8rem;
  }
}
