.topic-mini-format{display:flex;align-items:center;gap:5px;flex-wrap:nowrap;margin:3px 0 9px;max-width:100%}
.topic-mini-format button{display:inline-flex;align-items:center;justify-content:center;min-width:34px;min-height:34px;margin:0;padding:6px 9px;border:1px solid var(--line);border-radius:8px;background:color-mix(in srgb,var(--blue) 5%,var(--paper));color:var(--muted);font-size:13px;line-height:1.2;box-shadow:none;touch-action:manipulation}
.topic-mini-format button[data-format=bold]{font-weight:850}.topic-mini-format button[data-format=italic]{font-style:italic}.topic-mini-format button[data-format=inline-code]{font-family:ui-monospace,monospace}
.topic-mini-format button:active{background:var(--blue);color:#fff}.topic-mini-format button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.topic-format-hint{margin:0 0 8px;color:var(--muted);font-size:10px;line-height:1.4}
.topic-formatted{white-space:normal!important;overflow-wrap:anywhere;line-height:1.6}
.topic-formatted p{margin:0 0 .7em;white-space:pre-wrap}.topic-formatted>:last-child{margin-bottom:0}
.topic-formatted h3{margin:.7em 0 .4em;color:var(--ink);font-size:1.1em;font-weight:800;line-height:1.35;letter-spacing:-.015em}
.topic-formatted h3:first-child{margin-top:0}.topic-formatted strong{font-weight:800}.topic-formatted em{font-style:italic}
.topic-formatted code{padding:2px 5px;border:1px solid color-mix(in srgb,var(--blue) 20%,var(--line));border-radius:5px;background:color-mix(in srgb,var(--blue) 8%,var(--paper));color:var(--blue);font:.9em/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.topic-formatted blockquote {
 margin: .7em 0;
 padding: 12px 14px;
 border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
 border-left: 3.5px solid var(--accent);
 border-radius: 0 10px 10px 0;
 background: color-mix(in srgb, var(--accent) 8%, rgba(255, 255, 255, 0.03));
 color: #334155;
 font-style: italic;
 white-space: pre-wrap;
}
body.dark .topic-formatted blockquote { color: #cbd5e1; }
.topic-formatted blockquote:first-child{margin-top:0}

/* Text starts the card; formatting and reorder controls sit below the writing. */
.topics-dialog.topic-editor-dialog .topic-editor-block.topic-text-block{position:relative;display:block;padding:12px 14px 0}
.topic-text-block>.topic-block-tools{position:absolute;top:8px;right:8px;z-index:1}
.topics-dialog.topic-editor-dialog .topic-text-block>textarea{display:block;box-sizing:border-box;width:100%;min-height:110px;margin:0;padding:0 32px 12px 0;resize:none}
.topic-text-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px;margin-inline:-14px;padding:7px 10px;border-top:1px solid rgba(255,255,255,.06)}
.topic-text-footer>.topic-mini-format{margin:0;gap:3px;max-width:100%}
.topic-text-footer .topic-mini-format button{min-width:30px;min-height:32px;padding:5px 7px;border:0;background:transparent;font-size:12px}
.topic-block-reorder{display:flex;gap:3px;margin-left:auto}.topic-block-reorder:empty{display:none}
.topics-dialog.topic-editor-dialog .topic-block-reorder>.topic-block-control{width:28px;min-height:28px;font-size:16px}

/* On touch devices keep the active tools above the composer actions, away from selection callouts. */
.topic-editor-dialog .topic-compose-footer>.topic-mini-format.is-selection-docked{display:flex;flex:none;justify-content:flex-start;gap:6px;margin:0;padding:0 0 8px;border-bottom:1px solid var(--line);touch-action:manipulation;user-select:none;-webkit-user-select:none}
.topic-editor-dialog .topic-compose-footer>.topic-mini-format.is-selection-docked button{min-width:40px;min-height:40px;padding:7px 12px;font-size:14px;-webkit-touch-callout:none}
.topic-editor-dialog.has-docked-formatting .topic-compose-scroll{padding-bottom:72px;scroll-padding-bottom:84px}
