.tg-editor {
  min-width: 0;
  border: 1px solid var(--line, #b9b6ae);
  border-radius: 12px;
  background: var(--panel, #fffdf8);
  color: var(--ink, #24201b);
}

.tg-editor:focus-within {
  border-color: var(--accent, #8b4527);
}

.tg-editor-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px;
  border-bottom: 1px solid var(--line, #b9b6ae);
}

.tg-editor-tools :is(button, select), .tg-link-actions button {
  width: auto;
  min-height: 34px;
  border: 1px solid var(--line, #b9b6ae);
  border-radius: 7px;
  padding: 5px 9px;
  background: var(--panel, #fffdf8);
  color: var(--ink, #24201b);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

.tg-editor-tools :is(button, select):hover, .tg-editor-tools button[aria-pressed="true"] {
  background: var(--soft, #f5ebdb);
  border-color: var(--accent, #8b4527);
}

.tg-editor-tools [data-command="bold"] { font-weight: 800; }
.tg-editor-tools [data-command="italic"] { font-style: italic; }
.tg-editor-tools [data-command="underline"] { text-decoration: underline; }

.tg-editor-input {
  box-sizing: border-box;
  min-height: 8rem;
  padding: 11px;
  cursor: text;
}

.tg-editor-input:focus-visible {
  outline: 2px solid var(--accent, #8b4527);
  outline-offset: -2px;
}

.tg-editor-input:empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, currentColor 74%, transparent);
  pointer-events: none;
}

.tg-message-copy {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tg-message-copy :is(h1, h2, h3) {
  margin: .28em 0;
  color: inherit;
  line-height: 1.25;
}

.tg-message-copy h1 { font-size: 1.42em; }
.tg-message-copy h2 { font-size: 1.25em; }
.tg-message-copy h3 { font-size: 1.1em; }

.tg-message-copy blockquote {
  border-inline-start: 3px solid var(--accent, #8b4527);
  margin: .2em 0;
  padding: .22em .58em;
  border-radius: 0 5px 5px 0;
  background: color-mix(in srgb, currentColor 6%, transparent);
}

.tg-message-copy a {
  color: color-mix(in srgb, #3885b8 45%, currentColor);
  text-decoration: underline;
}
.tg-editor-count {
  display: block;
  padding: 4px 9px 7px;
  color: color-mix(in srgb, currentColor 74%, transparent);
}
.tg-editor-count.over-limit { color: var(--danger, #a32b25); font-weight: 700; }

.tg-link-dialog {
  box-sizing: border-box;
  width: min(24rem, calc(100% - 24px));
  border: 1px solid var(--line, #b9b6ae);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 30px #211d1833;
  background: var(--panel, #fffdf8);
  color: var(--ink, #24201b);
}

.tg-link-dialog::backdrop { background: #251d173b; }
.tg-link-dialog label { display: grid; gap: 6px; }
.tg-link-dialog input { width: 100%; min-width: 0; box-sizing: border-box; }
.tg-link-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.tg-link-actions button[type="submit"] { background: #8b4527; color: #fff; }

@media (max-width: 600px) {
  .tg-editor-tools :is(button, select), .tg-link-actions button { min-height: 44px; }
}
