/* Sego Posting Form: geometry only; active style supplies the palette. */
#postform #format-buttons,
#postform #colour_palette { display: none !important; }

#postform .sego-pf-toolbar,
#postform .sego-pf-panels,
#postform .sego-pf-icon-control {
    font-size: 13px;
}

#postform .sego-pf-toolbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    min-height: 34px;
    margin: 0 0 6px;
    padding: 3px 5px;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 25%, transparent);
    border-radius: 3px;
    background: color-mix(in srgb, currentColor 8%, transparent);
}

#postform .sego-pf-toolbar-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
}

#postform .sego-pf-mobile-more[hidden] { display: none; }

#postform .sego-pf-toolbar-group-end {
    margin-left: 0;
}

#postform .sego-pf-button,
#postform .sego-pf-control-button,
#postform .sego-pf-panel-toggle {
    box-sizing: border-box;
    min-width: 32px;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

#postform .sego-pf-button:hover,
#postform .sego-pf-button:focus-visible,
#postform .sego-pf-control-button:hover,
#postform .sego-pf-control-button:focus-visible,
#postform .sego-pf-panel-toggle:hover,
#postform .sego-pf-panel-toggle:focus-visible {
    border-color: currentColor;
    outline: 0;
    background: color-mix(in srgb, currentColor 12%, transparent);
}

#postform .sego-pf-button[aria-expanded="true"],
#postform .sego-pf-panel-toggle[aria-expanded="true"] {
    background: color-mix(in srgb, currentColor 16%, transparent);
}

#postform .sego-pf-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    min-width: 145px;
    max-width: min(92vw, 340px);
    max-height: min(60vh, 360px);
    overflow: auto;
    padding: 5px;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 4px;
    background: Canvas;
    color: CanvasText;
    box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
}

#postform .sego-pf-menu[hidden] { display: none; }
.sego-pf-link-dialog {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgb(0 0 0 / 25%);
}
.sego-pf-link-form {
    display: grid;
    gap: 10px;
    width: min(360px, 100%);
    padding: 16px;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 4px;
    background: Canvas;
    color: CanvasText;
    box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
}
.sego-pf-link-form label { display: grid; gap: 4px; }
.sego-pf-link-form input { box-sizing: border-box; width: 100%; min-height: 32px; padding: 5px 7px; font: inherit; }
.sego-pf-link-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.sego-pf-link-actions button { min-height: 30px; padding: 4px 10px; font: inherit; cursor: pointer; }
#postform .sego-pf-menu button {
    display: block;
    width: 100%;
    min-height: 30px;
    padding: 5px 9px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
#postform .sego-pf-menu button:hover,
#postform .sego-pf-menu button:focus-visible { background: color-mix(in srgb, CanvasText 10%, Canvas); outline: 0; }

#postform .sego-pf-icon-control { position: relative; margin: 0 0 4px; }
#postform .sego-pf-icon-control + dl { display: none; }
#postform .sego-pf-icon-menu { min-width: 220px; }
#postform .sego-pf-icon-menu label { display: inline-flex; align-items: center; min-width: 34px; min-height: 34px; padding: 3px; cursor: pointer; }
#postform .sego-pf-icon-menu input { position: absolute; opacity: 0; }
#postform .sego-pf-icon-menu input:focus-visible + img,
#postform .sego-pf-icon-menu label:hover img { outline: 2px solid currentColor; outline-offset: 2px; }
#postform .sego-pf-icon-preview img { max-width: 20px; max-height: 20px; vertical-align: middle; }
#postform .sego-pf-icon-control .sego-pf-menu { top: calc(100% + 3px); }

#postform .sego-pf-hidden-smiley-trigger { margin: 0 0 5px; }
#postform #smiley-box.sego-pf-smiley-popup { position: absolute; z-index: 19; top: calc(100% + 4px); left: 0; width: min(420px, 92vw); max-height: min(55vh, 330px); overflow: auto; margin: 0; padding: 8px; border: 1px solid currentColor; border-radius: 4px; background: Canvas; color: CanvasText; box-shadow: 0 4px 16px rgb(0 0 0 / 20%); }
#postform #smiley-box.sego-pf-smiley-popup[hidden] { display: none; }
#postform #smiley-box.sego-pf-smiley-popup .bbcode-status { display: none; }
#postform #message-box textarea { box-sizing: border-box; width: 100%; min-height: 260px; padding: 12px; resize: vertical; line-height: 1.5; }
#postform #message-box {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    float: none;
}
#postform #message-box textarea {
    display: block;
    max-width: none;
}
#postform .sego-pf-panels { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
#postform #tabs { display: none; }
#postform #options-panel,
#postform #attach-panel { display: none; }
#postform #options-panel.sego-pf-panel-open,
#postform #attach-panel.sego-pf-panel-open { display: block; }
#postform .sego-pf-editor-marker { display: none; }
details.sego-spoiler {
    margin: 8px 0;
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    border-radius: 4px;
}
details.sego-spoiler > summary {
    display: flex;
    align-items: center;
    padding: 6px 9px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}
details.sego-spoiler > summary::-webkit-details-marker { display: none; }
details.sego-spoiler > summary::marker { content: ""; }
details.sego-spoiler > summary::after {
    margin-inline-start: auto;
    content: "⌄";
    font-weight: 400;
}
details.sego-spoiler[open] > summary::after { content: "⌃"; }
details.sego-spoiler[open] > summary {
    margin-bottom: 9px;
    border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}
details.sego-spoiler[open] { padding-bottom: 9px; }
details.sego-spoiler .sego-spoiler-content { padding-inline: 16px 9px; }
.sego-offtopic {
    display: block;
    margin: 8px 0;
    padding: 2px 0 2px 12px;
    border-left: 2px solid color-mix(in srgb, currentColor 30%, transparent);
    color: color-mix(in srgb, currentColor 78%, transparent);
}
.sego-offtopic::before {
    display: block;
    margin-bottom: 5px;
    content: "Off";
    color: inherit;
    font-weight: 700;
}
html[lang^="ru"] .sego-offtopic::before { content: "Офф"; }

#postform .sego-pf-color-control {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 32px;
    min-height: 30px;
    padding: 2px 7px 3px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: inherit;
    cursor: pointer;
    font: inherit;
}
#postform .sego-pf-color-control:hover,
#postform .sego-pf-color-control:focus-within {
    border-color: currentColor;
    outline: 0;
    background: color-mix(in srgb, currentColor 12%, transparent);
}
#postform .sego-pf-color-letter { line-height: 1; font-weight: 600; }
#postform .sego-pf-color-indicator {
    width: 18px;
    height: 3px;
    margin-top: 2px;
    border-radius: 2px;
    background: #333333;
}
#postform .sego-pf-color-control input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}


/* SCEditor mode buttons are outside the native posting-form scope. */
.sceditor-toolbar .sego-sce-mode-switch { display: flex; align-items: center; gap: 2px; margin-left: auto; padding: 0 4px; }
.sceditor-toolbar .sego-sce-mode-switch button { min-height: 24px; padding: 2px 7px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.sceditor-toolbar .sego-sce-mode-switch button:hover,
.sceditor-toolbar .sego-sce-mode-switch button:focus-visible { border-color: currentColor; outline: 0; }
.sceditor-toolbar .sego-sce-mode-switch button.is-active { background: color-mix(in srgb, currentColor 18%, transparent); font-weight: 700; }
.sceditor-button-source.sego-sce-source-hidden { display: none !important; }

@media (max-width: 700px) {
    #postform .sego-pf-toolbar {
        flex-wrap: wrap;
        gap: 2px;
        padding: 3px;
    }
    #postform .sego-pf-toolbar-group-end { margin-left: 0; }
    #postform .sego-pf-toolbar.sego-pf-mobile-ready {
        flex-wrap: nowrap;
        overflow: visible;
    }
    #postform .sego-pf-button { min-width: 30px; padding-inline: 5px; }
    #postform .sego-pf-toolbar-group.sego-pf-mobile-empty { display: none; }
    #postform .sego-pf-mobile-more { position: static; flex: 0 0 auto; }
    #postform .sego-pf-mobile-more-menu {
        box-sizing: border-box;
        top: calc(100% + 4px);
        right: 0;
        left: auto;
        width: min(340px, calc(100% - 6px));
        max-width: calc(100% - 6px);
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        align-content: flex-start;
        gap: 2px;
        overflow: auto;
    }
    #postform .sego-pf-mobile-more-menu .sego-pf-button,
    #postform .sego-pf-mobile-more-menu .sego-pf-color-control {
        box-sizing: border-box;
        display: flex;
        flex: 0 0 auto;
        width: auto;
        min-width: 30px;
        min-height: 30px;
        margin: 0;
        padding: 4px 5px;
        border: 1px solid transparent;
        border-radius: 3px;
        text-align: center;
    }
    #postform .sego-pf-mobile-more-menu .sego-pf-color-control {
        align-items: center;
        justify-content: center;
    }
    #postform #message-box textarea { min-height: 180px; }
    .sceditor-toolbar .sego-sce-mode-switch { margin-left: 0; }
}

/* Viewport-aware popups. */
#postform .sego-pf-floating,
#postform #smiley-box.sego-pf-smiley-popup.sego-pf-floating {
    position: fixed !important;
    top: 8px;
    left: 8px;
    z-index: 10000;
    margin: 0;
    max-width: min(92vw, 420px);
    max-height: min(70vh, 420px);
    overflow: auto;
}
#postform .sego-pf-floating[data-sego-pf-menu] { min-width: 145px; }

/* The native smiley source stays in the form but is not rendered as a side column. */
#postform #smiley-box[hidden] { display: none !important; }
#postform .sego-pf-smiley-popup {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 5px;
    width: min(420px, 92vw);
    max-height: min(60vh, 360px);
    padding: 8px;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 4px;
    background: Canvas;
    color: CanvasText;
    box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
    overflow: auto;
}
#postform .sego-pf-smiley-popup[hidden] { display: none !important; }
#postform .sego-pf-smiley-popup a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 3px;
}
#postform .sego-pf-smiley-popup a:hover,
#postform .sego-pf-smiley-popup a:focus-visible {
    border-color: currentColor;
    background: color-mix(in srgb, currentColor 10%, transparent);
    outline: 0;
}
#postform .sego-pf-smiley-popup.sego-pf-floating {
    position: fixed !important;
    z-index: 10000;
    margin: 0;
}
#postform.sego-posting-form #smiley-box { display: none !important; }

/* Read-only topic context for the Standard Reply initial batch. */
#postform .sego-topic-context {
    width: 100%;
    margin-top: 24px;
}
#postform .sego-topic-context__feed {
    width: 100%;
}
#postform .sego-topic-context__post {
    padding: 18px 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
#postform .sego-topic-context__post:first-child { padding-top: 0; }
#postform .sego-topic-context__post:last-child { border-bottom: 0; }
#postform .sego-topic-context__header {
    margin-bottom: 8px;
    font-size: 0.95em;
}
#postform .sego-topic-context__author { font-weight: 700; }
#postform .sego-topic-context__date { opacity: 0.75; }
#postform .sego-topic-context__content { line-height: 1.5; }
#postform .sego-topic-context__attachments { margin-top: 12px; }

#postform .sego-topic-context__sentinel {
    width: 1px;
    height: 1px;
    overflow: hidden;
    pointer-events: none;
}
