
.bbcode-quote {
    border-left: 3px solid var(--color-primary-500);
    background: var(--color-surface-raised, rgba(255, 87, 34, 0.04));
    padding: 0.5rem 0.75rem;
    margin: 0.35rem 0;
    border-radius: 0 0.375rem 0.375rem 0;
    font-style: normal;
    font-size: 0.875rem;
    line-height: 1.5;
}

.dark .bbcode-quote {
    background: var(--color-dark-elevated, rgba(255, 87, 34, 0.06));
}

.bbcode-quote .bbcode-quote-author {
    font-size: 0.75rem;
    font-weight: 600;
    font-style: normal;
    color: var(--color-primary-500);
    margin-bottom: 0.2rem;
}

.bbcode-quote cite {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    font-style: normal;
    color: var(--color-primary-500);
    margin-bottom: 0.2rem;
}

.bbcode-quote[data-collapsible] .bbcode-quote-content {
    position: relative;
    max-height: 150px;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.bbcode-quote[data-collapsible]:not(.is-expanded) .bbcode-quote-content::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 87, 34, 0), var(--color-surface-raised, rgba(255, 87, 34, 0.04)));
    pointer-events: none;
}
.bbcode-quote.is-expanded .bbcode-quote-content {
    max-height: none;
}
.bbcode-quote__expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0.4rem;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-primary-500);
    background: transparent;
    border: 1px solid var(--color-border, rgba(127, 127, 127, 0.25));
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.bbcode-quote__expand:hover {
    background: var(--color-surface-raised, rgba(255, 87, 34, 0.08));
}
.dark .bbcode-quote[data-collapsible]:not(.is-expanded) .bbcode-quote-content::after {
    background: linear-gradient(to bottom, rgba(255, 87, 34, 0), var(--color-dark-elevated, rgba(255, 87, 34, 0.06)));
}

.rb-embed {
    display: flex;
    align-items: stretch;
    gap: 12px;
    max-width: 560px;
    margin: 10px 0;
    padding: 12px 14px 12px 16px;
    border: 1px solid var(--color-border, rgba(127, 127, 127, 0.18));
    border-radius: 14px;
    background: var(--color-surface, #ffffff);
    text-decoration: none;
    color: var(--color-text-primary, #0f172a);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.rb-embed::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary-500, #ff5722);
}
.rb-embed--user::before { background: #8b5cf6; }
.rb-embed--post::before { background: #0ea5e9; }
.rb-embed--forum::before { background: #10b981; }
.rb-embed:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    border-color: var(--color-primary-500, #ff5722);
}
a.rb-embed[href],
a.rb-embed[href]:hover,
a.rb-embed[href]:focus { text-decoration: none !important; }
.rb-embed__avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.rb-embed__avatar--lg { width: 54px; height: 54px; border-radius: 12px; }
.rb-embed__icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    font-size: 1.05rem;
}
.rb-embed__body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.rb-embed__head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rb-embed__title {
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.rb-embed__prefix:not(.rb-pfx) {
    font-size: 0.66rem;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 4px 8px;
    white-space: nowrap;
}
.rb-embed__prefix.rb-pfx {
    flex-shrink: 0;
}
.rb-embed__kind {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted, #94a3b8);
    border: 1px solid var(--color-border, rgba(127, 127, 127, 0.25));
    border-radius: 4px;
    padding: 2px 6px;
}
.rb-embed__rank { font-size: 0.72rem; color: var(--color-text-muted, #94a3b8); }
.rb-embed__byline {
    font-size: 0.74rem;
    color: var(--color-text-muted, #94a3b8);
    display: flex;
    gap: 6px;
    align-items: center;
}
.rb-embed__by { font-weight: 600; }
.rb-embed__dot { opacity: 0.5; }
.rb-embed__excerpt {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--color-text-muted, #94a3b8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rb-embed__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2px;
    font-size: 0.74rem;
    color: var(--color-text-muted, #94a3b8);
}
.rb-embed__m { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.rb-embed__m i { font-size: 0.78em; opacity: 0.8; }
.rb-embed__chev {
    display: flex;
    align-items: center;
    color: var(--color-text-muted, #94a3b8);
    opacity: 0.45;
    font-size: 0.8rem;
}
.rb-embed:hover .rb-embed__chev { opacity: 1; color: var(--color-primary-500, #ff5722); }

.bbcode-embed-internal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 8px 0;
    border: 1px dashed var(--color-border, rgba(127, 127, 127, 0.35));
    border-radius: 10px;
    background: var(--color-surface, #ffffff);
    font-size: 0.82rem;
    color: var(--color-text-muted, #94a3b8);
}

.bbcode-code-wrap {
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--color-border-dark, rgba(255, 255, 255, 0.08));
    background: #0d1117;
}

.bbcode-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bbcode-code-lang {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-primary-400, #ff8a5c);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bbcode-code-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.bbcode-code-copy:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.bbcode-code-copy.copied {
    color: #22c55e;
}

.bbcode-code {
    background: #0d1117;
    color: #e0e0e0;
    padding: 0.75rem;
    margin: 0;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.6;
    display: flex;
    gap: 0.75rem;
}

.bbcode-code code {
    background: transparent;
    color: inherit;
    font-size: inherit;
    padding: 0;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.bbcode-code-lines {
    display: flex;
    flex-direction: column;
    text-align: right;
    user-select: none;
    min-width: 2rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding-right: 0.75rem;
}

.bbcode-code-ln {
    font-size: 0.7rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.2);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.bbcode-code-wrap .bbcode-code-lines ~ code {
    flex: 1 0 auto;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

.bbcode-code-wrap .bbcode-code-lines {
    position: sticky;
    inset-inline-start: 0;
    z-index: var(--rb-z-raised, 1);
    flex: none;
    background: inherit;
    padding-inline-start: 0.75rem;
}

.bbcode-code-wrap .bbcode-code:has(> .bbcode-code-lines) {
    padding-inline-start: 0;
}

.bbcode-code-wrap .bbcode-code-ln {
    font-size: inherit;
    line-height: inherit;
}

@media print {
    .bbcode-code-wrap .bbcode-code-lines ~ code {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    .bbcode-code-wrap .bbcode-code-lines {
        display: none;
    }
}

.bbcode-code-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.bbcode-code-wrap--tall .bbcode-code {
    max-height: var(--rb-code-max-height, 24rem);
    overflow-y: auto;
}

.bbcode-code-wrap--tall.is-expanded .bbcode-code {
    max-height: none !important;
}

@media (max-width: 767.98px) {
    .bbcode-code-wrap--tall .bbcode-code {
        max-height: var(--rb-code-max-height-phone, 18rem);
    }
}

[data-theme="light"] .bbcode-code-wrap {
    background: #f8f9fc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .bbcode-code-header {
    background: #f1f5f9 !important;
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .bbcode-code-lang {
    color: var(--color-primary-600, #f24b18) !important;
}

[data-theme="light"] .bbcode-code-copy {
    color: #64748b !important;
}

[data-theme="light"] .bbcode-code-copy:hover {
    color: #1e293b !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .bbcode-code {
    background: #f8f9fc !important;
    color: #334155 !important;
}

[data-theme="light"] .bbcode-code code {
    color: #334155 !important;
    background: transparent !important;
}

[data-theme="light"] .bbcode-code-lines {
    border-right-color: #e2e8f0 !important;
}

[data-theme="light"] .bbcode-code-ln {
    color: #94a3b8 !important;
}

.bbcode-icode {
    background: var(--color-surface-raised, rgba(255, 87, 34, 0.08));
    color: var(--color-primary-600, #ff5722);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.dark .bbcode-icode {
    background: rgba(255, 87, 34, 0.12);
    color: var(--color-primary-400);
}

.bbcode-spoiler {
    margin: 0.5rem 0;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
    overflow: hidden;
}

.dark .bbcode-spoiler {
    border-color: var(--color-border-dark, rgba(255, 255, 255, 0.08));
}

.bbcode-spoiler>summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-surface-raised, rgba(0, 0, 0, 0.02));
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .bbcode-spoiler>summary {
    background: var(--color-dark-elevated, rgba(255, 255, 255, 0.03));
}

.bbcode-spoiler>summary::before {
    content: '▶';
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.bbcode-spoiler[open]>summary::before {
    transform: rotate(90deg);
}

.bbcode-spoiler> :not(summary) {
    padding: 0.75rem;
}

.bbcode-ispoiler:hover,
.bbcode-ispoiler:focus,
.bbcode-ispoiler.revealed {
    color: inherit;
    background: var(--color-surface-raised, rgba(0, 0, 0, 0.06));
}

.dark .bbcode-ispoiler {
    background: rgba(255, 255, 255, 0.15);
}

.dark .bbcode-ispoiler:hover,
.dark .bbcode-ispoiler.revealed {
    background: rgba(255, 255, 255, 0.06);
}

.bbcode-list {
    padding-left: 0;
    padding-inline-start: 1.5rem;
    margin: 0.25rem 0;
}
ul.bbcode-list { list-style-type: disc; }
ol.bbcode-list:not([type]) { list-style-type: decimal; }

.bbcode-wysiwyg ul,
.bbcode-wysiwyg ol {
    padding-left: 0 !important;
    padding-inline-start: 1.5rem !important;
    margin: 0.25rem 0 !important;
    display: block !important;
}

.bbcode-wysiwyg ul {
    list-style-type: disc !important;
}

.bbcode-wysiwyg ol:not([type]) {
    list-style-type: decimal !important;
}

.bbcode-wysiwyg li {
    margin: 0.15rem 0;
    display: list-item !important;
}

.bbcode-wysiwyg,
.bbcode-wysiwyg :is(p, div, li, blockquote, h1, h2, h3, h4, h5, h6):not([contenteditable="false"], [contenteditable="false"] *),
.bbcode-source-textarea {
    unicode-bidi: plaintext;
}
.bbcode-editor-area:dir(rtl) > .bbcode-wysiwyg,
.bbcode-source-area:dir(rtl) > .bbcode-source-textarea {
    text-align: right;
}

.bbcode-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0;
}

.bbcode-table-wrap > .bbcode-table {
    margin: 0;
}

.bbcode-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.bbcode-th,
.bbcode-td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.12));
    text-align: left;
    min-width: 4rem;
    overflow-wrap: anywhere;
}

.dark .bbcode-th,
.dark .bbcode-td {
    border-color: var(--color-border-dark, rgba(255, 255, 255, 0.08));
}

.bbcode-th {
    font-weight: 600;
    background: var(--color-surface-raised, rgba(0, 0, 0, 0.03));
}

.dark .bbcode-th {
    background: var(--color-dark-elevated, rgba(255, 255, 255, 0.04));
}

.bbcode-indent {
    margin: 0.25rem 0;
}

.bbcode-heading {
    margin: 0.5rem 0 0.25rem;
    font-weight: 700;
}

.bbcode-hr {
    border: none;
    border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.12));
    margin: 0.75rem 0;
}

.dark .bbcode-hr {
    border-color: var(--color-border-dark, rgba(255, 255, 255, 0.08));
}

.bbcode-php,
.bbcode-html {
    background: #0d1117;
    color: #e0e0e0;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.8rem;
    border: 1px solid var(--color-border-dark, rgba(255, 255, 255, 0.08));
}

[data-theme="light"] .bbcode-php,
[data-theme="light"] .bbcode-html {
    background: #f8f9fc;
    color: #334155;
    border-color: #e2e8f0;
}

.bbcode-mention {
    font-weight: 600;
    color: var(--color-primary-500);
    cursor: pointer;
}

.bbcode-mention:not(:hover) {
    text-decoration: none;
}
.bbcode-mention:hover {
    text-decoration: underline;
}

.bbcode-mention--group {
    cursor: default;
    padding: 0 0.4em;
    border-radius: 0.35em;
    background: color-mix(in srgb, var(--color-primary-500, #ff5722) 18%, transparent);
    color: var(--color-primary-700, var(--color-primary-500, #d2410f));
    text-decoration: none !important;
    font-weight: 700;
}

.bbcode-mention--group:hover {
    background: color-mix(in srgb, var(--color-primary-500, #ff5722) 28%, transparent);
}

.bbcode-mention--everyone,
.bbcode-mention--users {
    background: color-mix(in srgb, var(--color-warn, #f59e0b) 22%, transparent);
    color: var(--color-warn, #b45309);
}

.bbcode-mention--admin {
    background: color-mix(in srgb, var(--color-danger, #ef4444) 22%, transparent);
    color: var(--color-danger, #b91c1c);
}

.bbcode-mention--staff,
.bbcode-mention--mods {
    background: color-mix(in srgb, var(--color-success, #10b981) 22%, transparent);
    color: var(--color-success, #047857);
}

.bbcode-mention--inert,
.bbcode-mention--inert:hover {
    cursor: default;
    color: inherit;
    text-decoration: none !important;
}

.bbcode-embed {
    max-width: 100%;
    margin: 0.5rem 0;
}

.bbcode-embed iframe {
    max-width: 100%;
    border-radius: 0.5rem;
}

.bbcode-media {
    max-width: 100%;
    margin: 0.5rem 0;
}

.bbcode-media iframe,
.bbcode-media video,
.bbcode-media embed,
.bbcode-media object,
.bbcode-media img {
    max-width: 100%;
    border-radius: 0.5rem;
}

.bbcode-attach {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--color-surface-raised, rgba(255, 87, 34, 0.06));
    border-radius: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-primary-500);
    text-decoration: none;
}

.bbcode-attach:hover {
    text-decoration: underline;
}

.bbcode-hide {
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  border-left: 0;
  border-inline-start: 4px solid var(--color-primary-500, var(--primary, #4a90e2));
  border-radius: 0.25rem;
  background: var(--color-surface-variant, color-mix(in srgb, var(--foreground, #000) 4%, transparent));
}

[dir="rtl"] .bbcode-hide {
  border-left-width: 0;
}

.bbcode-hide-visible {
  border-inline-start-color: var(--color-success, var(--success, #2e7d32));
}

.bbcode-hide-locked {
  border-inline-start-color: var(--color-warning, var(--warning, var(--primary, #f59e0b)));
  color: var(--color-on-surface-muted, var(--muted-foreground, #b45309));
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bbcode-hide-icon {
  flex-shrink: 0;
  opacity: 0.75;
}

.bbcode-hide-message {
  font-size: 0.9em;
}

.bbcode-hide-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  text-align: start;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  @supports (--rb-contract: 1) {
  .bbcode-editor-wrapper .bbcode-hide-menu.rb-ed-hidemenu {
    max-height: min(380px, 50vh) !important;
    max-height: min(380px, 50dvh) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
  }
  .bbcode-editor-wrapper .bbcode-hide-menu.rb-ed-hidemenu > button {
    min-height: 44px !important;
  }
}

.bbcode-hide-edit {
  margin: 0.5rem 0;
  border: 1px dashed var(--color-warning, #f59e0b);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--color-warning, #f59e0b) 7%, transparent);
  overflow: hidden;
}

.bbcode-hide-edit__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-warning, #b45309);
  background: color-mix(in srgb, var(--color-warning, #f59e0b) 12%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, var(--color-warning, #f59e0b) 45%, transparent);
  -webkit-user-select: none;
  user-select: none;
}

.bbcode-hide-edit__head i {
  opacity: 0.85;
}

.bbcode-hide-edit__body {
  padding: 0.55rem 0.7rem;
  min-height: 1.4em;
  outline: none;
}

.bbcode-hide-edit__body:focus {
  background: color-mix(in srgb, var(--color-warning, #f59e0b) 4%, transparent);
}

.bbcode-ispoiler {
  background: var(--color-on-surface, #333);
  color: transparent;
  padding: 0.1em 0.3em;
  border-radius: 0.2rem;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.bbcode-lang-tabs {
  margin: 14px 0;
}
.bbcode-lang-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  border-bottom: 1px solid var(--border, #e4e4ea);
  background: transparent;
}
.bbcode-lang-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground, #6b7280);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  line-height: 1.4;
}
.bbcode-lang-tab:hover {
  background: var(--muted, rgba(0,0,0,0.04));
  color: var(--foreground, #18181b);
}
.bbcode-lang-tab.is-active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
  background: var(--surface, #fff);
}
.bbcode-lang-tab .bbcode-lang-flag {
  width: 20px;
  height: 15px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  display: inline-block;
  vertical-align: middle;
}

.rb-langc-overlay {
    position: fixed; inset: 0; z-index: var(--rb-z-overlay, 100000);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.rb-langc-dialog {
  width: 100%; max-width: 860px; max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--surface, #18181b);
  border: 1px solid var(--border, #2a2a2e);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 64px -12px rgba(0,0,0,0.5);
}
.rb-langc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #2a2a2e);
}
.rb-langc-head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.rb-langc-head h3 i { color: var(--primary, #f24b18); }
.rb-langc-x { border: 0; background: none; cursor: pointer; color: var(--muted-foreground, #999); font-size: 16px; padding: 4px 8px; border-radius: 6px; }
.rb-langc-x:hover { background: var(--muted, rgba(0,0,0,0.05)); color: var(--foreground, #fff); }

.rb-langc-add { padding: 12px 18px 0; }
.rb-langc-search { position: relative; }
.rb-langc-search .rb-input { width: 100%; padding: 8px 12px; font-size: 14px; }
.rb-langc-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5;
  max-height: 260px; overflow-y: auto;
  background: var(--surface, #18181b);
  border: 1px solid var(--border, #2a2a2e); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); padding: 4px;
}
.rb-langc-suggest-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; background: none; cursor: pointer;
  border-radius: 6px; font-size: 14px; color: var(--foreground, #fff); text-align: left;
}
.rb-langc-suggest-item:hover { background: var(--muted, rgba(0,0,0,0.06)); }
.rb-langc-code { margin-left: auto; opacity: .5; font-size: 11px; text-transform: uppercase; }
.rb-langc-flag { font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; font-size: 1.1em; line-height: 1; flex-shrink: 0; }

.rb-langc-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 18px 0; }
.rb-langc-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px 6px 12px; border: 1px solid var(--border, #2a2a2e);
  background: var(--surface-2, #202024); color: var(--muted-foreground, #999);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.rb-langc-tab.is-active { color: var(--foreground, #fff); border-color: var(--primary, #f24b18); box-shadow: inset 0 -2px 0 var(--primary, #f24b18); }
.rb-langc-tab-x { font-size: 11px; opacity: .5; padding: 2px; border-radius: 4px; }
.rb-langc-tab-x:hover { opacity: 1; color: #ef4444; }

.rb-langc-body { padding: 14px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.rb-langc-empty { padding: 40px 18px; text-align: center; color: var(--muted-foreground, #999); }
.rb-langc-empty i { font-size: 30px; opacity: .4; display: block; margin-bottom: 10px; }
.rb-langc-empty p { margin: 0; font-size: 13.5px; }

.rb-langc-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border, #2a2a2e);
}
.bbcode-lang-panels {
  padding: 14px 2px 0;
}
.bbcode-lang-panel {
  display: none;
}
.bbcode-lang-panel.is-active {
  display: block;
  animation: bbcodeLangFade 0.15s ease;
}
.post-prose > .bbcode-lang-tabs:last-child {
  margin-bottom: 0;
}
.bbcode-lang-panel.is-active > :last-child {
  margin-bottom: 0;
}
@keyframes bbcodeLangFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.bbcode-lang-block + .bbcode-lang-block {
  margin-top: 8px;
}
.bbcode-lang-block[data-lang]::before {
  content: attr(data-lang-name);
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground, #6b7280);
  margin-bottom: 4px;
}
.bbcode-gallery {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 12px 0;
  border: 1px solid var(--border, #2a2a2e);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2, #16161a);
  outline: none;
}
.bbcode-gallery * { box-sizing: border-box; }
.bbcode-gallery__viewport {
  position: relative;
  width: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  cursor: pointer;
}
.bbcode-gallery__viewport { overflow: hidden; }
.bbcode-gallery__track { width: 100%; display: block; }
.bbcode-gallery__slide { display: none; text-align: center; }
.bbcode-gallery__slide.is-active { display: block; }
.bbcode-gallery.is-ready .bbcode-gallery__track {
  display: flex;
  direction: ltr;
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.35, 1);
  will-change: transform;
}
.bbcode-gallery.is-ready .bbcode-gallery__slide {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 100%;
  min-width: 100%;
}
.bbcode-gallery__img {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 560px);
  margin: 0 auto;
  object-fit: contain;
}
.bbcode-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  color: #fff; font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, opacity .2s, transform .15s;
  z-index: 2;
  opacity: 0;
}
.bbcode-gallery:hover .bbcode-gallery__nav,
.bbcode-gallery:focus-within .bbcode-gallery__nav { opacity: 1; }
@media (pointer: coarse), (max-width: 768px) { .bbcode-gallery__nav { opacity: 1; } }
.bbcode-gallery__nav:hover { background: rgba(0, 0, 0, 0.75); transform: translateY(-50%) scale(1.06); }
.bbcode-gallery__nav--prev { left: 10px; }
.bbcode-gallery__nav--next { right: 10px; }
.bbcode-gallery__expand {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  color: #fff; font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, opacity .2s;
  z-index: 2;
  opacity: 0;
}
.bbcode-gallery:hover .bbcode-gallery__expand,
.bbcode-gallery:focus-within .bbcode-gallery__expand { opacity: 1; }
@media (pointer: coarse), (max-width: 768px) { .bbcode-gallery__expand { opacity: 1; } }
.bbcode-gallery__expand:hover { background: rgba(0, 0, 0, 0.75); }
.bbcode-gallery__counter {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  z-index: 2;
  pointer-events: none;
}
.bbcode-gallery__thumbs {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--surface-2, rgba(0, 0, 0, 0.15));
}
.bbcode-gallery__thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  opacity: 0.65;
  transition: opacity .15s, border-color .15s;
}
.bbcode-gallery__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
}
.bbcode-gallery__thumb:hover { opacity: 1; }
.bbcode-gallery__thumb.is-active {
  opacity: 1;
  border-color: var(--primary, #f24b18);
}

html.rb-lightbox-open,
html.rb-lightbox-open body { overflow: hidden; }
.rb-lightbox {
  position: fixed;
  inset: 0;
    z-index: var(--rb-z-lightbox, 100070);
  display: none;
  flex-direction: column;
  background: rgba(8, 8, 10, 0.94);
  backdrop-filter: blur(4px);
  color: #fff;
}
.rb-lightbox.is-open { display: flex; }
.rb-lightbox__bar { flex: none; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 12px 8px 18px; }
.rb-lightbox__counter {
  flex: none;
  color: #fff; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 12px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.rb-lightbox__counter:empty { display: none; }
.rb-lightbox__caption { flex: 1 1 auto; min-width: 0; font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-lightbox__actions { flex: none; display: flex; gap: 6px; margin-inline-start: auto; }
.rb-lightbox__btn,
.rb-lightbox__nav {
  width: 42px; height: 42px;
  padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff; font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background .15s;
}
.rb-lightbox__btn[hidden] { display: none; }
.rb-lightbox__btn:hover,
.rb-lightbox__nav:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
.rb-lightbox button:focus-visible,
.rb-lightbox a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rb-lightbox__stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 66px; }
.rb-lightbox__frame { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.rb-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  cursor: zoom-in;
  transition: opacity .15s;
}
.rb-lightbox.is-loading .rb-lightbox__img { opacity: .25; }
.rb-lightbox.is-zoomed .rb-lightbox__frame { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.rb-lightbox.is-zoomed .rb-lightbox__img { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
.rb-lightbox__spinner { position: absolute; display: none; width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: rb-lightbox-spin .8s linear infinite; }
.rb-lightbox.is-loading .rb-lightbox__spinner { display: block; }
@keyframes rb-lightbox-spin { to { transform: rotate(360deg); } }
.rb-lightbox__error { position: absolute; display: none; margin: 0; padding: 10px 16px; border-radius: 10px; background: rgba(0, 0, 0, .6); font-size: 14px; }
.rb-lightbox.is-error .rb-lightbox__error { display: block; }
.rb-lightbox.is-error .rb-lightbox__img { visibility: hidden; }
.rb-lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); display: none; z-index: 2; }
.rb-lightbox.is-multi .rb-lightbox__nav { display: flex; }
.rb-lightbox__nav--prev { inset-inline-start: 12px; }
.rb-lightbox__nav--next { inset-inline-end: 12px; }
[dir="rtl"] .rb-lightbox__nav i { transform: scaleX(-1); }
.rb-lightbox__thumbs { flex: none; display: none; gap: 8px; overflow-x: auto; padding: 10px 12px 14px; scrollbar-width: thin; }
.rb-lightbox.is-multi .rb-lightbox__thumbs { display: flex; }
.rb-lightbox__thumbs > :first-child { margin-inline-start: auto; }
.rb-lightbox__thumbs > :last-child { margin-inline-end: auto; }
.rb-lightbox__thumb { flex: none; width: 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, .08); opacity: .55; cursor: pointer; transition: opacity .15s, border-color .15s; }
.rb-lightbox__thumb img { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; }
.rb-lightbox__thumb:hover,
.rb-lightbox__thumb:focus-visible { opacity: .9; }
.rb-lightbox__thumb.is-active { opacity: 1; border-color: var(--primary, #f24b18); }
@media (max-width: 640px) {
  .rb-lightbox__bar { padding-inline-start: 12px; }
  .rb-lightbox__stage { padding: 0 6px; }
  .rb-lightbox__nav { width: 38px; height: 38px; background: rgba(0, 0, 0, .45); }
  .rb-lightbox__thumb { width: 52px; height: 40px; }
}
@media (max-width: 767.98px) {
  .rb-lightbox__nav::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  .rb-lightbox__img, .rb-lightbox__thumb { transition: none; }
}
a.bbcode-attachment--image,
img.bbcode-img[role="button"] { cursor: zoom-in; }
img.bbcode-img[role="button"]:focus-visible { outline: 2px solid var(--primary, #f24b18); outline-offset: 2px; }
.bbcode-gallery__dots {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  padding: 8px;
}
.bbcode-gallery__dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: var(--border, #3a3a3e);
  transition: background .15s, transform .15s;
}
.bbcode-gallery__dot.is-active {
  background: var(--primary, #f24b18);
  transform: scale(1.25);
}

.bbcode-gallery-edit {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px; margin: 6px 0;
  border: 1px dashed var(--border, #2a2a2e);
  border-radius: 8px;
  position: relative;
}
.bbcode-gallery-edit::before {
  content: "🖼 " attr(data-gallery-label);
  position: absolute; top: -9px; left: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--surface, #18181b); padding: 0 6px;
  color: var(--muted-foreground, #888);
}
.bbcode-gallery-edit:not([data-gallery-label])::before {
  content: "🖼 Gallery";
}
.bbcode-gallery-edit img {
  width: 64px !important; height: 64px !important;
  object-fit: cover; border-radius: 6px; margin: 0 !important;
}

.rb-gallery-build {
  margin: 12px 0 4px; padding: 10px;
  border: 1px solid var(--border, #2a2a2e); border-radius: 10px;
}
.rb-gallery-build__head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
  color: var(--foreground, #fff);
}
.rb-gallery-build__grid { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-gallery-build__item { position: relative; width: 64px; height: 64px; }
.rb-gallery-build__item img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border, #2a2a2e);
}
.rb-gallery-build__rm {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: #ef4444; color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.rb-gallery-build__hint { font-size: 12px; color: var(--muted-foreground, #888); margin: 0; }

.post-prose iframe,
.bbcode-content iframe {
    max-width: 100%;
}

.math-display {
    max-width: 100%;
    overflow-x: auto;
}
.math-display + br {
    display: none;
}
.bbcode-wysiwyg .bbcode-math {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.92em;
    background: var(--muted, rgba(127, 127, 127, 0.12));
    border-radius: 4px;
    padding: 0 0.25em;
}
.bbcode-wysiwyg div.bbcode-math {
    display: block;
    margin: 0.25em 0;
    padding: 0.35em 0.5em;
    white-space: pre-wrap;
}

.bbcode-quote,
.bbcode-spoiler,
.bbcode-hide,
.bbcode-lang-block {
    min-width: 0;
    overflow-wrap: anywhere;
}

.bbcode-editor-wrapper {
    position: relative;
}
.rb-ed-ctxbar {
    position: absolute;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, rgba(127, 127, 127, 0.25));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.rb-ed-ctxbar__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    border: 0;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--foreground, #111);
    font-size: 12px;
    line-height: 1;
}
.rb-ed-ctxbar__btn:hover { background: var(--muted, rgba(127, 127, 127, 0.15)); }
.rb-ed-ctxbar__btn.is-active { background: color-mix(in srgb, var(--primary, #e9701d) 18%, transparent); color: var(--primary, #e9701d); }
.rb-ed-ctxbar__btn--danger { color: #ef4444; }
.rb-ed-ctxbar__btn--orig { gap: 5px; padding: 0 8px; white-space: nowrap; }
.rb-ed-ctxbar__btn--add::after,
.rb-ed-ctxbar__btn--del::after {
    content: '+';
    position: absolute;
    top: -3px;
    right: -1px;
    font-size: 9px;
    font-weight: 800;
    color: var(--primary, #e9701d);
}
.rb-ed-ctxbar__btn--del::after { content: '\00d7'; color: #ef4444; }
.rb-ed-ctxbar__sep { width: 1px; height: 16px; background: var(--border, rgba(127, 127, 127, 0.25)); margin: 0 3px; }
.rb-ed-ctxbar__num {
    width: 64px;
    height: 26px;
    padding: 0 6px;
    font-size: 12px;
    border: 1px solid var(--border, rgba(127, 127, 127, 0.25));
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--foreground, #111);
}
img.bbcode-img[width] { height: auto; }
img.bbcode-img { display: inline-block; }

.rb-ed-slashmenu {
    z-index: 99999;
    min-width: 210px;
    max-height: min(320px, 50vh);
    overflow-y: auto;
    padding: 4px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, rgba(127, 127, 127, 0.25));
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.rb-ed-slashmenu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--foreground, #111);
    font-size: 0.82rem;
    text-align: left;
}
.rb-ed-slashmenu__item.is-active,
.rb-ed-slashmenu__item:hover {
    background: color-mix(in srgb, var(--primary, #e9701d) 12%, transparent);
    color: var(--primary, #e9701d);
}
.rb-ed-slashmenu__ico { width: 16px; text-align: center; }
.rb-ed-slashmenu__empty { padding: 8px 10px; font-size: 0.78rem; color: var(--muted-foreground, #888); }

.rb-ed-imghandle {
    position: absolute;
    z-index: 61;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--primary, #e9701d);
    border: 2px solid var(--surface, #fff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    cursor: nwse-resize;
    touch-action: none;
}

.rb-ed-quote-jump {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    font-size: 0.72rem;
    color: var(--muted-foreground, #888);
    text-decoration: none;
    cursor: pointer;
}
.rb-ed-quote-jump:hover { color: var(--primary, #e9701d); }

.bbcode-content a[href]:not([class]),
.post-prose a[href]:not([class]),
.bbcode-wysiwyg a.link,
.bbcode-content a.link {
    color: var(--primary, #2b5bd7);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
.bbcode-content a[href]:not([class]):hover,
.post-prose a[href]:not([class]):hover,
.bbcode-wysiwyg a.link:hover,
.bbcode-content a.link:hover {
    filter: brightness(1.15);
    text-decoration-thickness: 2px;
}

.rb-content-lock{margin:1rem 0 0;padding:1rem;border:1px solid color-mix(in srgb,var(--primary) 28%,var(--border));border-radius:var(--radius-lg,.75rem);background:color-mix(in srgb,var(--primary) 5%,var(--surface));color:var(--foreground);max-width:100%;overflow-wrap:anywhere;font-size:.9375rem;line-height:1.5;scroll-margin-top:calc(var(--rb-sticky-header-h,0px) + 1rem)}
.rb-content-lock__body{container:rb-content-lock / inline-size}
.rb-content-lock :where(p){margin:.25rem 0}
.rb-content-lock--unavailable .rb-content-lock__msg{margin:0;display:flex;gap:.5rem;align-items:center;color:var(--muted-foreground)}
.rb-content-lock__sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (max-width:639.98px){.rb-content-lock{padding:.875rem;border-radius:var(--radius,.5rem)}}
.rb-reply-locked p{display:flex;gap:.375rem;align-items:center;justify-content:center;flex-wrap:wrap}
@media (max-width:639.98px){.rb-reply-locked:is(#rb-reply-locked,.rb-reply-locked) .btn.btn{min-height:44px;display:inline-flex;align-items:center}}

#rb-user-card:has(#rb-uc-extra:not([hidden])){max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain}
#rb-uc-extra{margin:.5rem 16px 0;padding:.5rem 0 0;border-top:1px solid var(--border);font-size:.8125rem;line-height:1.4}
#rb-uc-extra[hidden]{display:none}
.rb-uc-extra__row{display:flex;gap:.5rem;align-items:center;justify-content:space-between;min-width:0;padding:.125rem 0}
.rb-uc-extra__label{display:flex;flex:1 1 auto;gap:.375rem;align-items:center;min-width:0;overflow:hidden;color:var(--muted-foreground)}
.rb-uc-extra__label i{flex:none;width:1em;text-align:center}
.rb-uc-extra__text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rb-uc-extra__value{flex:0 1 auto;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--foreground);font-weight:700;font-variant-numeric:tabular-nums}
