.comment-section{
  margin: 40px 0 20px;
  padding: 18px 18px 22px;
  border:none;
  background: var(--color-secondary);
  font-family: "Display Light", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
}

.comment-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-title{
  margin: 0;
  font-size: clamp(20px, 3.2vw, 26px);
}

.comment-sub{
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

.comment-form{
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-form textarea{
  width: 100%;
  min-height: 96px;
  border-radius: 14px;
  border: 1px solid rgba(38, 59, 70, 0.25);
  padding: 12px 14px;
  font-size: 16px;
  font-family: "Display Light", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  background: #fff;
  color: var(--color-text);
  resize: vertical;
}

.comment-form textarea:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--color-primary) 70%, #fff);
  outline-offset: 2px;
}

.comment-form-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.comment-submit,
.comment-cancel{
  padding: 9px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-family: "Display Light", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  cursor: pointer;
  border: 1px solid var(--color-border);
}

.comment-submit{
  background: var(--color-btn);
  color: #fff;
  border:none;
}
.comment-submit:hover{
  background: color-mix(in srgb, var(--color-btn) 75%, var(--color-accent-strong));}
.comment-submit:disabled{
  opacity: .7;
  cursor: not-allowed;
  box-shadow: none;
}

.comment-cancel{
  background: transparent;
  color: var(--color-text);
}

.comment-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: clamp(240px, 32vh, 360px);
  overflow-y: auto;
  padding-right: 6px;
}

.comment-card{
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--color-card-bg);
}

.comment-card.is-reply{
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.comment-card.is-reply .comment-header{
  gap: 8px;
}

.comment-card.is-reply .comment-avatar{
  width: 34px;
  height: 34px;
}

.comment-card.is-reply .comment-username{
  font-size: 0.9rem;
}

.comment-card.is-reply .comment-body{
  margin: 4px 0 6px;
  font-size: 0.9rem;
}

.comment-card.is-reply .comment-actions{
  gap: 8px;
}

.comment-card.is-reply .like-stack{
  min-width: 44px;
  gap: 4px;
}

.comment-card.is-reply .comment-like{
  width: 36px;
  height: 36px;
}

.comment-replies-toggle-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  margin: 4px 0 8px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.comment-replies-toggle-wrap::before{
  content:"";
  width: 22px;
  height: 1px;
  background: var(--color-primary);
  opacity: .7;
  flex: 0 0 auto;
}

.comment-replies-toggle{
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--color-primary-strong);
  cursor: pointer;
}

.comment-replies{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 26px;
  padding-left: 10px;
}

.comment-replies[hidden]{
  display:none;
}

.comment-header{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: none;
  background: var(--color-card-bg);
}

.comment-username{
  margin: 0;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent-strong);
}
.comment-username .rank-icon{ margin-left: 2px; }

.comment-meta{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-muted);
}

.creator-badge{
  background: var(--color-accent-strong);
  color: var(--color-secondary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.comment-body{
  margin: 6px 0 10px;
  white-space: pre-wrap;
  color: var(--color-text);
}

.comment-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-actions-right{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.like-stack{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 52px;
}

.comment-like{
  width: 42px;
  height: 42px;
  border:none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: rgba(250, 235, 215, 0);
}

.comment-like img{
  width: 20px;
  height: 20px;
}
.like-count{
  font-size: 12px;
  color: var(--color-muted);
}

.comment-reply{
  background: transparent;
  border: none;
  color: var(--color-btn);
  font-weight: 700;
  cursor: pointer;
  font-family: "Display Bold";
  font:inherit;
}

.comment-delete{
  background: transparent;
  border: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.comment-delete img{
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.comment-empty{
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

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

.comments-trigger{
  display:flex;
  align-items:center;
  gap:10px;
}

.comments-trigger-shell{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.comments-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.comments-toggle__icon{
  width:18px;
  height:18px;
  display:inline-block;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/comments.svg") center/contain no-repeat;
  mask: url("/assets/icons/comments.svg") center/contain no-repeat;
}

.code-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.code-toggle__icon{
  width:18px;
  height:18px;
  display:inline-block;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/code.svg") center/contain no-repeat;
  mask: url("/assets/icons/code.svg") center/contain no-repeat;
}

.comments-modal{
  --comments-modal-pad: clamp(12px, 2vh, 24px);
  position:fixed;
  inset:0;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: var(--comments-modal-pad);
  background: rgba(0, 0, 0, 0.55);
  z-index: 8000;
  overflow-y:auto;
}

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

.comments-modal__card{
  width:min(760px, 96vw);
  max-height: calc(100vh - (var(--comments-modal-pad) * 2));
  overflow:auto;
  position: relative;
  z-index: 8001;
  background: var(--color-secondary);
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}

.comments-modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-soft);
}

.comments-modal__head strong{
  font-family: "Display Bold", "Display Book", "Display Light", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  letter-spacing:.02em;
}

.comments-modal__close{
  border:0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-text);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease, transform .2s ease;
}

.comments-modal__close:hover{
  background: color-mix(in srgb, var(--color-secondary) 70%, #fff);
  transform: translateY(-1px);
}

.comments-modal__close-icon{
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/burgeropen.svg") center/contain no-repeat;
  mask: url("/assets/icons/burgeropen.svg") center/contain no-repeat;
}

.comments-modal__body{
  padding: 16px;
}

.comments-modal .comment-section{
  margin:0;
  padding:0;
  background: transparent;
}

.comments-modal .comment-list{
  max-height:none;
  overflow:visible;
  padding-right:0;
}

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

.comments-wrap--inline{
  display:block;
  flex: 0 0 auto;
  min-height: auto;
  width: 100%;
}

.comments-wrap--inline #commentsSection{
  display:block;
  flex: 0 0 auto;
  min-height: auto;
  width: 100%;
}

.comments-wrap--inline #commentsSection .comment-section{
  min-height: auto;
  width: 100%;
}

.comments-wrap--inline #commentsSection .comment-list{
  flex: initial;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  width: 100%;
}

.comments-wrap--inline #commentsSection .comment-card{
  width: 100%;
  align-self: stretch;
}

@media (max-width: 640px){
  .comment-section{ padding: 14px; }
  .comment-head{ display: none; }
  .comment-card.is-reply{
    margin-left: 0;
    padding-left: 0;
  }
  .comment-header{ align-items: flex-start; }
  .comment-list{
    max-height:none;
    overflow:visible;
    padding-right:0;
  }
}
