.comment-section {
  --comment-composer-reserve: 120px;
  display: grid;
  gap: 16px;
}

.comment-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
}

.comment-list-title {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.comment-list-title strong {
  color: var(--primary);
  font-size: 15px;
  font-weight: 900;
}

.comment-list {
  display: grid;
  gap: 16px;
  padding-bottom: var(--comment-composer-reserve);
}

.comment-thread {
  display: grid;
  gap: 14px;
}

.comment-item,
.reply-item {
  display: grid;
  align-items: start;
}

.comment-item {
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
}

.reply-item {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
}

.comment-avatar,
.reply-avatar,
.comment-composer-avatar {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  overflow: hidden;
}

.comment-avatar,
.comment-composer-avatar {
  width: 40px;
  height: 40px;
}

.reply-avatar {
  width: 32px;
  height: 32px;
}

.comment-avatar img,
.reply-avatar img,
.comment-composer-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.comment-item-body,
.reply-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.comment-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.comment-item-head-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.comment-item-author {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.comment-avatar-link,
.reply-avatar-link {
  display: inline-flex;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}

.comment-author-link {
  color: inherit;
  text-decoration: none;
}

.comment-author-link:visited {
  color: inherit;
}

.comment-author-link:hover,
.comment-author-link:focus-visible {
  color: var(--primary);
}

.comment-item-text {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-item-actions,
.comment-reply-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-item-action,
.reply-toggle-btn,
.comment-action-menu-item {
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.comment-item-action,
.reply-toggle-btn {
  border: 0;
  background: transparent;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}

.reply-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
}

.comment-action-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.comment-action-wrap:has(.comment-action-menu:not([hidden])) {
  z-index: var(--fdc-action-menu-z-index, 1100);
}

.comment-menu-toggle {
  border: 0;
  background: transparent;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}

.comment-menu-toggle:focus-visible {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  color: var(--primary);
}

.comment-menu-toggle .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

.comment-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: var(--fdc-action-menu-min-width, 112px);
  width: max-content;
  max-width: var(--fdc-action-menu-max-width, min(184px, calc(100vw - 24px)));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 2px;
  z-index: var(--fdc-action-menu-z-index, 1100);
}

.comment-action-menu[hidden] {
  display: none !important;
}

.comment-action-menu-item {
  width: 100%;
  min-height: var(--fdc-action-menu-item-height, 40px);
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.comment-action-menu-item:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.comment-action-menu-item .material-symbols-outlined {
  width: var(--fdc-action-menu-icon-size, 18px);
  flex: 0 0 var(--fdc-action-menu-icon-size, 18px);
  font-size: var(--fdc-action-menu-icon-size, 18px);
  line-height: 1;
}

.comment-action-menu-item .fdc-action-menu-label {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
}

.comment-action-menu-item .fdc-action-menu-meta {
  margin-left: auto;
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
}

.reply-container {
  margin-left: 52px;
}

.reply-list {
  display: grid;
  gap: 14px;
}

.reply-compose {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid color-mix(in srgb, var(--line) 72%, transparent);
  display: grid;
  gap: 10px;
}

.comment-reply-input,
.comment-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.comment-reply-input {
  min-height: 64px;
  padding: 10px 12px;
}

.comment-auth-gate[hidden] {
  display: none !important;
}

.composer-dock {
  position: sticky;
  bottom: 18px;
  z-index: 20;
  margin-top: calc(var(--comment-composer-reserve) * -1);
  padding-top: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s step-end;
}

.composer-dock.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear;
}

.composer-dock[hidden] {
  display: none !important;
}

.composer-dock::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), color-mix(in srgb, var(--panel) 94%, transparent));
}

.reply-status-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.reply-status-bar.is-active {
  display: flex;
}

.reply-status-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.reply-status-main .material-symbols-outlined {
  font-size: 16px;
  line-height: 1;
}

.reply-cancel-btn {
  border: 0;
  background: transparent;
  padding: 0 8px;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  min-height: 28px;
  border-radius: 10px;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}

.reply-cancel-btn:focus-visible {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.comment-composer-shell {
  display: grid;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 96%, var(--bg));
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.comment-composer-shell[hidden] {
  display: none !important;
}

.comment-composer-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  width: 100%;
  min-width: 0;
}

.comment-composer-row.is-expanded {
  align-items: flex-end;
}

.comment-composer-input-wrap {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
}

.comment-composer-input-wrap.is-expanded {
  align-items: flex-end;
}

.comment-composer-row.is-expanded .comment-composer-avatar-host,
.comment-composer-row.is-expanded .comment-anonymous-toggle {
  align-self: flex-end;
}

.comment-composer-avatar-host {
  display: inline-flex;
  align-items: center;
}

.comment-anonymous-toggle {
  min-width: fit-content;
  min-height: 40px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.comment-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.comment-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 128px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, #ffffff 96%, var(--bg));
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 46px 8px 16px;
  display: block;
  box-shadow: none;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, color .16s ease;
  resize: none;
  overflow-y: auto;
  box-sizing: border-box;
}

.composer-dock.is-floating .comment-composer-shell:hover .comment-input,
.composer-dock.is-floating .comment-composer-shell:focus-within .comment-input {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  background: #ffffff;
}

.comment-input:focus,
.comment-reply-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 32%, transparent);
  background: #ffffff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

.comment-submit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  transition: color .16s ease, opacity .16s ease;
  z-index: 1;
}

.comment-composer-input-wrap.is-expanded .comment-submit {
  top: auto;
  bottom: 5px;
  transform: none;
}

.comment-submit:disabled {
  cursor: default;
  opacity: 0.38;
}

.comment-submit .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.comment-status-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: 0 18px 12px;
}

.comment-status-row[hidden] {
  display: none !important;
}

.comment-anonymous-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.comment-status {
  margin: 0;
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
}

.comment-status[data-tone='ok'] {
  color: var(--primary);
}

.comment-status[data-tone='error'] {
  color: #dc2626;
}

@media (max-width: 720px) {
  .comment-composer-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .comment-composer-avatar-host {
    align-self: center;
  }

  .comment-composer-input-wrap {
    width: 100%;
    flex-basis: 100%;
  }

  .comment-status {
    width: 100%;
    text-align: left;
  }

  .reply-container {
    margin-left: 0;
    padding-left: 44px;
  }

  .comment-section {
    --comment-composer-reserve: 136px;
  }
}
