/* WeiG Gitalk 2.x composer accessibility enhancements.
   Applied after the pinned upstream bundle and local visual skin.
   Never reparent or clone the Preact editors: drafts remain in Gitalk state. */
#post-comment {
  --weig-editor-font: 16px;
  --weig-editor-main-height: 210px;
  --weig-editor-reply-height: 210px;
}

#post-comment .weig-editor-tools {
  position: sticky;
  top: 66px;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 7px 9px;
  border: 1px solid var(--card-border-color, #d0d7de);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  color: var(--font-color, #24292f);
  font: 13px/1.35 system-ui, sans-serif;
}
#post-comment .weig-editor-tools[hidden] { display: none; }
#post-comment .weig-editor-tools button {
  min-width: 34px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
#post-comment .weig-editor-tools button:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
#post-comment .weig-editor-tools button:focus-visible {
  outline: 2px solid #238636;
  outline-offset: 2px;
}
#post-comment .weig-editor-tools button[disabled] { opacity: .4; cursor: not-allowed; }
#post-comment .weig-editor-tools button[aria-pressed='true'] {
  border-color: #238636;
  box-shadow: inset 0 0 0 1px #238636;
}
#post-comment .weig-editor-tools output { min-width: 39px; text-align: center; font-variant-numeric: tabular-nums; }
#post-comment .weig-editor-tools .weig-editor-context { margin-inline-end: auto; font-weight: 600; }

/* Both Preact composer types have upstream hard-coded 34/36px height,
   max-height and resize:none; increase their specificity without !important
   on height, so the native textarea drag handle can still update it. */
#post-comment #gitalk-container .gt-container .gt-header-comment {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
#post-comment #gitalk-container .gt-container .gt-header-textarea,
#post-comment #gitalk-container .gt-container .gt-reply-textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  max-height: min(80dvh, 900px);
  padding: 12px;
  border: 1px solid var(--gt-color-panel-line-strong, #d0d7de);
  border-radius: 7px;
  background: var(--gt-color-input-bg, #fff);
  color: var(--gt-color-text, inherit);
  font-size: var(--weig-editor-font);
  line-height: 1.6;
  resize: vertical;
  overflow-y: auto;
}
#post-comment #gitalk-container .gt-container .gt-header-textarea { height: var(--weig-editor-main-height); }
#post-comment #gitalk-container .gt-container .gt-reply-textarea { height: var(--weig-editor-reply-height); }
#post-comment #gitalk-container .gt-container .gt-header-textarea:focus,
#post-comment #gitalk-container .gt-container .gt-reply-textarea:focus {
  border: 1px solid #238636;
  box-shadow: 0 0 0 2px rgba(35, 134, 54, .2);
}
#post-comment #gitalk-container .gt-container .gt-header-controls {
  align-self: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
}
#post-comment #gitalk-container .gt-container .gt-composer-preview .preview-body {
  max-height: min(62dvh, 680px);
  font-size: var(--weig-editor-font);
}

/* Enlarge only the selected editor; never enlarge every reply at once. */
#post-comment.weig-editor-expanded.weig-editor-target-main #gitalk-container .gt-container .gt-header-textarea,
#post-comment.weig-editor-expanded.weig-editor-target-reply #gitalk-container .gt-container .gt-reply-textarea {
  height: min(68dvh, 720px) !important;
  max-height: 75dvh;
}


/* -------- Integrated comment typography --------
   The A-/A+ preference applies to the entire conversation, not only drafts.
   Preserve semantic hierarchy instead of making all text the same size. */
#post-comment #gitalk-container .gt-container {
  --weig-comment-size: var(--weig-editor-font);
  font-size: var(--weig-comment-size);
}
#post-comment #gitalk-container .gt-container :is(.gt-comment-body, .gt-comment-body.markdown-body, .gt-composer-preview .preview-body, .gt-reply-preview .preview-body) {
  font-size: var(--weig-comment-size) !important;
  line-height: 1.75;
}
#post-comment #gitalk-container .gt-container .gt-comment-body :is(p, li, ul, ol, blockquote, table, td, th) {
  font-size: inherit !important;
}
#post-comment #gitalk-container .gt-container .gt-comment-body h1 { font-size: 1.7em !important; }
#post-comment #gitalk-container .gt-container .gt-comment-body h2 { font-size: 1.45em !important; }
#post-comment #gitalk-container .gt-container .gt-comment-body h3 { font-size: 1.24em !important; }
#post-comment #gitalk-container .gt-container .gt-comment-body :is(h4, h5, h6) { font-size: 1.07em !important; }
#post-comment #gitalk-container .gt-container .gt-comment-body :is(pre, code),
#post-comment #gitalk-container .gt-container .gt-reply-preview :is(pre, code),
#post-comment #gitalk-container .gt-container .gt-composer-preview :is(pre, code) {
  font-size: calc(var(--weig-editor-font) * .84) !important;
}
#post-comment #gitalk-container .gt-container :is(.gt-comment-username, .gt-title, .gt-counts, .gt-meta-title) {
  font-size: calc(var(--weig-editor-font) * .90) !important;
}
#post-comment #gitalk-container .gt-container :is(.gt-comment-date, .gt-comment-badge, .gt-comment-actions, .gt-comment-reply, .gt-reaction-chip, .gt-reaction-trigger, .gt-reply-actions .gt-btn, .gt-header-controls .gt-btn, .gt-comments-controls .gt-btn, .gt-preview-label, .preview-label) {
  font-size: calc(var(--weig-editor-font) * .80) !important;
}
#post-comment .weig-editor-tools,
#post-comment .weig-editor-tools button {
  font-size: calc(var(--weig-editor-font) * .81);
}
#post-comment #gitalk-container .gt-container .gt-composer-preview .preview-body {
  font-size: var(--weig-editor-font) !important;
}

/* Consistent neutral borders in both Butterfly themes. The old toolbar
   fallback was light-gray/white even when the page was almost black. */
#post-comment {
  --weig-tools-surface: #fff;
  --weig-tools-line: #d0d7de;
  --weig-tools-color: #24292f;
}
html[data-theme='dark'] #post-comment {
  --weig-tools-surface: #0d0f11;
  --weig-tools-line: #30363d;
  --weig-tools-color: #c9d1d9;
}
#post-comment .weig-editor-tools {
  position: relative;
  top: auto;
  z-index: 2;
  border: 1px solid var(--weig-tools-line);
  background: var(--weig-tools-surface);
  color: var(--weig-tools-color);
  box-shadow: none;
}
#post-comment .weig-editor-tools button {
  border: 1px solid var(--weig-tools-line);
  color: inherit;
  background: transparent;
}
#post-comment .weig-editor-tools button[aria-pressed='true'] {
  border-color: #238636;
  box-shadow: inset 0 0 0 1px #238636;
}
#post-comment #gitalk-container .gt-container :is(.gt-header-textarea, .gt-reply-textarea, .gt-reply-preview) {
  border: 1px solid var(--gt-color-panel-line-strong, #30363d);
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
}

/* Expanded editors remain in normal document flow. Increase the parent panel,
   not only the textarea, and never let the composer dock over the article. */
#post-comment.weig-editor-expanded #gitalk-container .gt-container {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}
#post-comment.weig-editor-expanded #gitalk-container .gt-container .gt-header {
  position: relative !important;
  inset: auto !important;
  transform: none !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  flex: 0 0 auto;
}
#post-comment.weig-editor-expanded.weig-editor-target-main #gitalk-container .gt-container .gt-comments {
  flex: 0 1 auto;
  max-height: min(48dvh, 520px) !important;
  min-height: 140px;
  overflow-y: auto;
}
#post-comment.weig-editor-expanded.weig-editor-target-reply #gitalk-container .gt-container .gt-comments {
  flex: 0 1 auto;
  max-height: min(75dvh, 760px) !important;
  min-height: 160px;
  overflow-y: auto;
}
#post-comment.weig-editor-expanded.weig-editor-target-main #gitalk-container .gt-container .gt-header-textarea {
  height: min(48dvh, 460px) !important;
  max-height: 65dvh;
}
#post-comment.weig-editor-expanded.weig-editor-target-reply #gitalk-container .gt-container .gt-reply-textarea {
  height: min(45dvh, 420px) !important;
  max-height: 55dvh;
}
#post-comment.weig-editor-expanded #gitalk-container .gt-container .gt-header-placeholder {
  display: none;
}

/* Native Fullscreen API lifts the whole comment section into the browser's
   top layer; no nested fixed editor or DOM reparenting, so no sidebar overlap. */
#post-comment.weig-editor-native-full:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--weig-tools-surface);
  color: var(--weig-tools-color);
  box-sizing: border-box;
}
#post-comment.weig-editor-native-full:fullscreen .comment-head {
  display: none;
}
#post-comment.weig-editor-native-full:fullscreen .weig-editor-tools {
  flex: 0 0 auto;
  position: relative;
  top: 0;
  margin: 0 0 8px;
  z-index: 2;
}
/* Butterfly's comment-wrap and its inner tab div sit BETWEEN #post-comment
   and #gitalk-container. Both must stretch in native fullscreen. */
#post-comment.weig-editor-native-full:fullscreen .comment-wrap,
#post-comment.weig-editor-native-full:fullscreen .comment-wrap > div {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
#post-comment.weig-editor-native-full:fullscreen #gitalk-container {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
#post-comment.weig-editor-native-full:fullscreen #gitalk-container .gt-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  max-height: none !important;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#post-comment.weig-editor-native-full:fullscreen #gitalk-container .gt-container .gt-meta {
  display: none;
}
#post-comment.weig-editor-native-full.weig-editor-target-main:fullscreen #gitalk-container .gt-container .gt-comments,
#post-comment.weig-editor-native-full.weig-editor-target-main:fullscreen #gitalk-container .gt-container .gt-header-placeholder,
#post-comment.weig-editor-native-full.weig-editor-target-reply:fullscreen #gitalk-container .gt-container .gt-header {
  display: none !important;
}
#post-comment.weig-editor-native-full.weig-editor-target-main:fullscreen #gitalk-container .gt-container .gt-header {
  position: relative !important;
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 12px;
  height: 100%;
  max-height: none;
  min-height: 0;
  width: auto !important;
  padding: 12px;
  transform: none !important;
}
#post-comment.weig-editor-native-full.weig-editor-target-main:fullscreen #gitalk-container .gt-container :is(.gt-header-comment, .gt-composer-body, .gt-editor) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
#post-comment.weig-editor-native-full.weig-editor-target-main:fullscreen #gitalk-container .gt-container .gt-header-textarea {
  flex: 1 1 auto;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  resize: none;
}
#post-comment.weig-editor-native-full.weig-editor-target-reply:fullscreen #gitalk-container .gt-container .gt-comments {
  flex: 1 1 auto;
  max-height: none !important;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  scroll-padding-block: 24px;
}
#post-comment.weig-editor-native-full.weig-editor-target-reply:fullscreen #gitalk-container .gt-container .gt-reply-textarea {
  height: min(57dvh, 650px) !important;
  max-height: none;
  resize: vertical;
}
#post-comment.weig-editor-native-full:fullscreen #gitalk-container .gt-container .gt-composer-preview .preview-body,
#post-comment.weig-editor-native-full:fullscreen #gitalk-container .gt-container .gt-reply-preview .preview-body {
  max-height: 60dvh;
  overflow-y: auto;
}
#post-comment.weig-editor-native-full:fullscreen #gitalk-container .gt-container .gt-header-placeholder {
  display: none;
}
#post-comment #gitalk-container .gt-container .gt-reply-preview {
  min-height: 120px;
  max-height: min(62dvh, 660px);
  padding: 12px;
  border-radius: 7px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}
#post-comment #gitalk-container .gt-container .gt-reply-editor.is--preview > .gt-editor {
  display: none;
}
#post-comment #gitalk-container .gt-container .gt-btn-preview-reply {
  margin-inline-end: auto;
}
@media (max-width: 600px) {
  #post-comment .weig-editor-tools {
    top: auto;
    flex-wrap: wrap;
    padding: 7px;
  }
  #post-comment .weig-editor-tools .weig-editor-context { width: 100%; }
  #post-comment.weig-editor-native-full:fullscreen {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }
}


/* Gitalk reply sign-in prompt. <dialog>.showModal() puts it in the browser
   top layer, unlike the previous notice hidden at the top of the thread.
   Colors inherit the same light/dark theme as the rest of the comment UI. */
#post-comment #gitalk-container .gt-container .gt-reply-login-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 22px;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 12px;
  background: var(--gt-color-panel-solid, var(--weig-tools-surface));
  color: var(--gt-color-text, var(--weig-tools-color));
  box-shadow: 0 18px 56px rgba(0, 0, 0, .28);
  font: inherit;
  overflow: auto;
}
#post-comment #gitalk-container .gt-container .gt-reply-login-dialog::backdrop {
  background: rgba(0, 0, 0, .58);
}
#post-comment #gitalk-container .gt-container .gt-reply-login-message {
  margin: 0 0 22px;
  color: inherit;
  font-size: max(14px, var(--weig-editor-font));
  line-height: 1.55;
}
#post-comment #gitalk-container .gt-container .gt-reply-login-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
#post-comment #gitalk-container .gt-container :is(.gt-reply-login-cancel, .gt-reply-login-confirm) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  font: inherit;
  font-size: max(13px, calc(var(--weig-editor-font) * .9));
  cursor: pointer;
}
#post-comment #gitalk-container .gt-container .gt-reply-login-cancel {
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  background: transparent;
  color: inherit;
}
#post-comment #gitalk-container .gt-container .gt-reply-login-confirm {
  border: 1px solid #238636;
  background: #238636;
  color: #fff;
}
#post-comment #gitalk-container .gt-container :is(.gt-reply-login-cancel, .gt-reply-login-confirm):focus-visible {
  outline: 2px solid var(--gt-color-accent, #2f81f7);
  outline-offset: 3px;
}
@media (max-width: 600px) {
  #post-comment #gitalk-container .gt-container .gt-reply-login-dialog {
    padding: 18px;
  }
}


/* Unified signed-out GitHub login actions. GitHub's familiar green (#238636)
   is shared by the composer, missing-thread and existing login notice. */
#post-comment #gitalk-container .gt-container .gt-btn-login,
#post-comment #gitalk-container .gt-container .gt-reply-login-confirm {
  background: #238636;
  background-color: #238636;
  border: 1px solid #238636;
  color: #fff;
  box-shadow: none;
  font-weight: 600;
}
#post-comment #gitalk-container .gt-container .gt-btn-login:hover,
#post-comment #gitalk-container .gt-container .gt-reply-login-confirm:hover {
  background: #2ea043;
  background-color: #2ea043;
  border-color: #2ea043;
  color: #fff;
}
#post-comment #gitalk-container .gt-container .gt-btn-login:focus-visible,
#post-comment #gitalk-container .gt-container .gt-reply-login-confirm:focus-visible {
  outline: 2px solid #3fb950;
  outline-offset: 3px;
}
#post-comment #gitalk-container .gt-container .gt-composer-login-btn {
  min-height: 38px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  flex: 0 0 auto;
}
/* The placeholder now is a real accessible button, not an inert textarea. */
#post-comment #gitalk-container .gt-container .gt-composer-login-field {
  appearance: none;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 38px;
  text-align: start;
  font: inherit;
  font-size: max(13px, calc(var(--weig-editor-font) * .83));
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  color: var(--gt-color-text-2, var(--weig-tools-color));
  border: 1px solid var(--gt-color-input-border, var(--weig-tools-line));
  cursor: pointer;
}
#post-comment #gitalk-container .gt-container .gt-composer-login-field:hover {
  border-color: var(--gt-color-main-border, #238636);
}
#post-comment #gitalk-container .gt-container .gt-composer-login-field:focus-visible {
  border-color: #3fb950;
  outline: 2px solid #3fb950;
  outline-offset: 2px;
}
@media (max-width: 479px) {
  #post-comment #gitalk-container .gt-container .gt-composer-login {
    gap: 6px;
  }
  #post-comment #gitalk-container .gt-container .gt-composer-login-btn {
    height: 36px;
    min-height: 36px;
    padding-inline: 9px;
    font-size: 12px;
  }
}


/* V3: ONE native editor surface shared by main comments and all reply entrypoints.
   Supersedes the pinned Gitalk's compact single-line composer layout.
   Upload controls appear only if an authenticated storage adapter is configured. */
#post-comment #gitalk-container .gt-container .gt-header {
  align-items: stretch;
  height: auto;
  min-height: 0;
}
#post-comment #gitalk-container .gt-container .gt-header-comment {
  container-type: inline-size;
  container-name: gt-footer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
#post-comment #gitalk-container .gt-container :is(.gt-composer-body, .gt-reply-editor).gt-shared-editor {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 8px;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  overflow: visible;
  container-type: inline-size;
  container-name: gt-editor;
}
#post-comment #gitalk-container .gt-container .gt-shared-editor-top {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-bottom: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
}
#post-comment #gitalk-container .gt-container .gt-editor-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}
#post-comment #gitalk-container .gt-container :is(.gt-editor-tab, .gt-format-btn) {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 30px;
  min-height: 30px;
  padding: 4px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--gt-color-text-2, var(--weig-tools-color));
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#post-comment #gitalk-container .gt-container .gt-editor-tab[aria-pressed='true'] {
  color: var(--gt-color-text, var(--weig-tools-color));
  background: var(--gt-color-wash-strong, rgba(139,148,158,.12));
  font-weight: 600;
}
#post-comment #gitalk-container .gt-container :is(.gt-editor-tab, .gt-format-btn):hover:not(:disabled) {
  background: var(--gt-color-wash-strong, rgba(139,148,158,.12));
  color: var(--gt-color-text, var(--weig-tools-color));
}
#post-comment #gitalk-container .gt-container :is(.gt-editor-tab, .gt-format-btn):focus-visible {
  outline: 2px solid #3fb950;
  outline-offset: 1px;
}
#post-comment #gitalk-container .gt-container :is(.gt-editor-tab, .gt-format-btn):disabled {
  opacity: .45;
  cursor: not-allowed;
}
#post-comment #gitalk-container .gt-container .gt-markdown-toolbar {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}
#post-comment #gitalk-container .gt-container .gt-format-extra {
  display: inline-flex;
  gap: 2px;
}
#post-comment #gitalk-container .gt-container .gt-format-overflow { display: none; position: relative; }
#post-comment #gitalk-container .gt-container .gt-format-overflow summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  color: var(--gt-color-text-2, var(--weig-tools-color));
  cursor: pointer;
  user-select: none;
}
#post-comment #gitalk-container .gt-container .gt-format-overflow summary::-webkit-details-marker { display: none; }
#post-comment #gitalk-container .gt-container .gt-format-overflow summary:focus-visible {
  outline: 2px solid #3fb950;
  outline-offset: 2px;
}
#post-comment #gitalk-container .gt-container .gt-format-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 8px;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
#post-comment #gitalk-container .gt-container .gt-shared-editor-stage {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 120px;
  padding: 8px;
}
#post-comment #gitalk-container .gt-container .gt-shared-editor-stage > .gt-editor {
  display: flex;
  flex: 1 1 auto;
  min-height: 120px;
  width: 100%;
}
#post-comment #gitalk-container .gt-container .gt-shared-editor-stage :is(.gt-header-textarea, .gt-reply-textarea) {
  flex: 1 1 auto;
  box-sizing: border-box;
  width: 100%;
  min-height: 115px;
  height: 160px;
  max-height: min(70dvh, 720px);
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  line-height: 1.6;
  resize: vertical;
  background: transparent;
  color: var(--gt-color-text);
  font-size: var(--weig-editor-font, 16px);
}
#post-comment #gitalk-container .gt-container .gt-shared-editor.is--preview .gt-shared-editor-stage > .gt-editor {
  display: none;
}
#post-comment #gitalk-container .gt-container .gt-shared-editor-stage :is(.gt-composer-preview, .gt-reply-preview) {
  width: 100%;
  box-sizing: border-box;
  max-height: min(70dvh, 720px);
  min-height: 120px;
  overflow: auto;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}
#post-comment #gitalk-container .gt-container .gt-editor-footer {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
#post-comment #gitalk-container .gt-container .gt-footer-account {
  grid-column: 1;
  min-width: 0;
  justify-self: start;
}
#post-comment #gitalk-container .gt-container .gt-footer-center {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
  max-width: 100%;
}
#post-comment #gitalk-container .gt-container .gt-footer-actions {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  white-space: nowrap;
}
#post-comment #gitalk-container .gt-container .gt-editor-account {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 7px;
}
#post-comment #gitalk-container .gt-container .gt-editor-account-avatar {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
}
#post-comment #gitalk-container .gt-container .gt-editor-account-login {
  display: inline-block;
  max-width: min(190px, 25vw);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gt-color-text);
  font-size: 12px;
  font-weight: 600;
}
#post-comment #gitalk-container .gt-container .gt-editor-account-logout {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 6px;
  background: transparent;
  color: var(--gt-color-text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
#post-comment #gitalk-container .gt-container .gt-editor-account-logout:hover {
  color: var(--gt-color-text);
  border-color: var(--gt-color-main-border, #238636);
}
#post-comment #gitalk-container .gt-container .gt-editor-account-logout:focus-visible {
  outline: 2px solid #3fb950;
  outline-offset: 2px;
}
#post-comment #gitalk-container .gt-container .gt-reply-box {
  container-type: inline-size;
  container-name: gt-footer;
  max-width: 100%;
  min-width: 0;
}
/* Query the actual editor width: a nested reply can be narrow on desktop. */
@container gt-editor (max-width: 540px) {
  #post-comment #gitalk-container .gt-container .gt-format-extra { display: none; }
  #post-comment #gitalk-container .gt-container .gt-format-overflow { display: block; }
  #post-comment #gitalk-container .gt-container .gt-markdown-toolbar { gap: 0; }
  #post-comment #gitalk-container .gt-container :is(.gt-editor-tab, .gt-format-btn) {
    min-width: 27px;
    padding: 4px 5px;
  }
}
@container gt-editor (max-width: 390px) {
  
  #post-comment #gitalk-container .gt-container .gt-editor-tabs { gap: 0; }
}
#post-comment #gitalk-container .gt-container .gt-editor-footer > :is(button, .gt-btn, a) {
  flex: 0 0 auto;
}
#post-comment #gitalk-container .gt-container .gt-editor-account-login {
  max-width: min(150px, 17vw);
}
@media (max-width: 600px) {
  #post-comment #gitalk-container .gt-container .gt-editor-footer { gap: 5px; }
  #post-comment #gitalk-container .gt-container .gt-editor-account { gap: 4px; }
  #post-comment #gitalk-container .gt-container .gt-editor-account-avatar { flex-basis: 22px; width: 22px; height: 22px; }
  #post-comment #gitalk-container .gt-container .gt-editor-account-login { max-width: 72px; }
  #post-comment #gitalk-container .gt-container .gt-editor-account-logout { padding: 4px; font-size: 11px; }
}


#post-comment #gitalk-container .gt-container .gt-editor-logout-icon { display: none; }
#post-comment #gitalk-container .gt-container .gt-footer-actions .gt-btn {
  max-width: none;
  min-width: 0;
}
@container gt-footer (max-width: 475px) {
  #post-comment #gitalk-container .gt-container .gt-editor-account-login { display: none; }
  #post-comment #gitalk-container .gt-container .gt-editor-footer { gap: 4px; }
  #post-comment #gitalk-container .gt-container .gt-editor-account-logout {
    padding: 4px 6px;
    min-width: 28px;
    min-height: 28px;
  }
  #post-comment #gitalk-container .gt-container .gt-editor-logout-text { display: none; }
  #post-comment #gitalk-container .gt-container .gt-editor-logout-icon { display: inline; }
  #post-comment #gitalk-container .gt-container .gt-footer-actions { gap: 4px; }
  #post-comment #gitalk-container .gt-container .gt-footer-actions .gt-btn-cancel-reply {
    padding-inline: 6px;
    font-size: 11px;
  }
}
@container gt-footer (max-width: 300px) {
  #post-comment #gitalk-container .gt-container .gt-editor-account-avatar {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }
  #post-comment #gitalk-container .gt-container .gt-editor-footer {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  #post-comment #gitalk-container .gt-container .gt-footer-actions .gt-btn {
    padding-inline: 4px;
  }
}


/* One GitHub-native attachment handoff in the shared middle footer slot. */
#post-comment #gitalk-container .gt-container .gt-github-draft-transfer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--gt-color-text-2, var(--weig-tools-color));
  text-decoration: none;
  white-space: nowrap;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-link:hover:not(:disabled) {
  border-color: var(--gt-color-panel-line-strong, var(--weig-tools-line));
  color: var(--gt-color-text, var(--weig-tools-color));
  text-decoration: none;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-link:focus-visible {
  outline: 2px solid #3fb950;
  outline-offset: 2px;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-link:disabled {
  cursor: not-allowed;
  opacity: .48;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
#post-comment #gitalk-container .gt-container .gt-github-draft-status {
  position: absolute;
  bottom: calc(100% + 4px);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  padding: 5px 8px;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 6px;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  color: var(--gt-color-text, var(--weig-tools-color));
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0,0,0,.15);
}
#post-comment #gitalk-container .gt-container .gt-github-copy-fallback {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 8px;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  color: var(--gt-color-text, var(--weig-tools-color));
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
#post-comment #gitalk-container .gt-container .gt-github-copy-fallback textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 70px;
  max-height: 25dvh;
  resize: vertical;
  border: 1px solid var(--gt-color-panel-line-strong, var(--weig-tools-line));
  border-radius: 5px;
  background: var(--gt-color-input-bg, var(--weig-tools-surface));
  color: inherit;
  font: inherit;
  font-size: 13px;
}
#post-comment #gitalk-container .gt-container .gt-editor-footer { position: relative; }
@container gt-footer (max-width: 475px) {
  #post-comment #gitalk-container .gt-container .gt-github-draft-label { display: none; }
  #post-comment #gitalk-container .gt-container .gt-github-draft-link { padding-inline: 3px; }
}
