/* Compact visual editor for front-end comments */
.steponee-comment-editor {
    position: relative;
    min-width: 0;
}

.comment-format-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 7px;
    padding: 5px;
    border: 1px solid #d7e1eb;
    border-radius: 11px;
    background: #f2f6fa;
    box-sizing: border-box;
}

.comment-format-btn,
.comment-sticker,
.comment-text-reaction,
.comment-reaction-tab {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.comment-format-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 31px;
    height: 29px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #425466;
    font-size: 13px;
    line-height: 1;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.comment-format-btn:hover,
.comment-format-btn:focus-visible,
.comment-format-btn.is-active {
    border-color: #c2d2e2;
    background: #fff;
    color: var(--so-link);
    outline: none;
}

.comment-format-btn.is-active {
    box-shadow: inset 0 0 0 1px rgba(47, 137, 217, .10);
}

.comment-format-btn--bold {
    font-size: 14px;
}

.comment-format-btn--italic {
    font-family: Georgia, serif;
    font-size: 15px;
}

.comment-format-btn--strike span {
    text-decoration: line-through;
}

.comment-format-btn--spoiler {
    min-width: auto;
    padding-inline: 9px;
    font-size: 12px;
    font-weight: 700;
}

.comment-visual-editor {
    width: 100%;
    min-height: 146px;
    padding: 11px 12px;
    border: 1px solid #b8c8d8;
    border-radius: 9px;
    background: #fff;
    color: var(--so-text);
    font: inherit;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.comment-visual-editor:focus {
    border-color: #6fa8dc;
    box-shadow: 0 0 0 2px rgba(47, 137, 217, .10);
}

.comment-visual-editor.is-invalid {
    border-color: #d65b5b;
    box-shadow: 0 0 0 2px rgba(214, 91, 91, .10);
}

.comment-visual-editor:empty::before {
    content: attr(data-placeholder);
    color: #7d8995;
    pointer-events: none;
}

.comment-visual-editor strong,
.comment-visual-editor b {
    font-weight: 700;
}

.comment-visual-editor em,
.comment-visual-editor i {
    font-style: italic;
}

.comment-visual-editor del,
.comment-visual-editor s,
.comment-visual-editor strike {
    text-decoration: line-through;
    opacity: .82;
}

/* While composing, spoiler text stays visible but is clearly marked. */
.comment-compose-spoiler {
    display: inline;
    padding: 1px 5px;
    border: 1px dashed #aebdca;
    border-radius: 5px;
    background: #e8eef3;
    color: #48596a;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.comment-source-field {
    position: absolute !important;
    left: 0;
    bottom: 0;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.comment-reaction-picker {
    position: relative;
}

.comment-reaction-toggle {
    padding-inline: 5px;
}

.comment-reaction-toggle img {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.comment-reaction-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 7px);
    z-index: 40;
    width: 304px;
    max-width: calc(100vw - 28px);
    padding: 8px;
    border: 1px solid #d6e0ea;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(18, 38, 63, .14);
    box-sizing: border-box;
}

.comment-reaction-popover[hidden] {
    display: none !important;
}

.comment-reaction-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e4ebf1;
}

.comment-reaction-tab {
    min-width: 0;
    height: 31px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #4c5f72;
    font-size: 14px;
    line-height: 1;
}

.comment-reaction-tab:hover,
.comment-reaction-tab:focus-visible,
.comment-reaction-tab.is-active {
    border-color: #c8d6e3;
    background: #eef4f9;
    color: var(--so-link);
    outline: none;
}

.comment-reaction-panel[hidden] {
    display: none !important;
}

.comment-sticker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.comment-sticker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    min-width: 0;
    padding: 3px;
    border-radius: 8px;
    background: transparent;
    line-height: 1;
}

.comment-sticker img {
    display: block;
    width: 100%;
    max-width: 38px;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    pointer-events: none;
}

.comment-sticker:hover,
.comment-sticker:focus-visible {
    background: #eef4f9;
    outline: none;
}

.comment-text-reaction-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.comment-text-reaction {
    min-height: 32px;
    padding: 5px 9px;
    border: 1px solid #dbe4ec;
    border-radius: 8px;
    background: #f8fafc;
    color: #34495e;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

.comment-text-reaction-grid--ja .comment-text-reaction {
    font-size: 13px;
}

.comment-text-reaction:hover,
.comment-text-reaction:focus-visible {
    border-color: #bfd0df;
    background: #eef4f9;
    color: var(--so-link);
    outline: none;
}

.comment-compose-sticker,
.comment-inline-sticker {
    display: inline-block;
    width: 32px;
    height: 32px;
    margin: 0 2px;
    object-fit: contain;
    vertical-align: -9px;
}

.comment-compose-sticker {
    user-select: none;
    -webkit-user-select: none;
}

.comment-content strong {
    font-weight: 700;
}

.comment-content del {
    opacity: .8;
}

.comment-spoiler {
    display: inline-flex;
    align-items: baseline;
    max-width: 100%;
    margin: 0 2px;
    padding: 1px 6px;
    border-radius: 6px;
    background: #dce4ec;
    color: #566474;
    cursor: pointer;
    vertical-align: baseline;
    transition: background .15s ease, color .15s ease;
}

.comment-spoiler__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .01em;
}

.comment-spoiler__content {
    display: none;
    margin-left: 5px;
    color: inherit;
}

.comment-spoiler.is-open {
    background: #edf2f6;
    color: var(--so-text);
}

.comment-spoiler.is-open .comment-spoiler__label {
    color: #738394;
}

.comment-spoiler.is-open .comment-spoiler__content {
    display: inline;
}

.comment-spoiler:focus-visible {
    outline: 2px solid rgba(47, 137, 217, .35);
    outline-offset: 2px;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-format-toolbar {
    border-color: rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .045);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-format-btn {
    color: #bac8d6;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-format-btn:hover,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-format-btn:focus-visible,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-format-btn.is-active {
    border-color: rgba(159, 209, 255, .20);
    background: rgba(159, 209, 255, .08);
    color: #dceeff;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-visual-editor {
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .045);
    color: var(--so-text);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-visual-editor:focus {
    border-color: rgba(159, 209, 255, .42);
    box-shadow: 0 0 0 2px rgba(159, 209, 255, .08);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-compose-spoiler {
    border-color: #61707d;
    background: #414d58;
    color: #e1e8ef;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-popover {
    border-color: rgba(255, 255, 255, .12);
    background: #29323c;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .30);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-tabs {
    border-bottom-color: rgba(255, 255, 255, .09);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-tab,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-text-reaction {
    color: #c8d5e2;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-text-reaction {
    border-color: rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .035);
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-tab:hover,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-tab:focus-visible,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-reaction-tab.is-active,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-sticker:hover,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-sticker:focus-visible,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-text-reaction:hover,
:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-text-reaction:focus-visible {
    border-color: rgba(159, 209, 255, .18);
    background: rgba(159, 209, 255, .10);
    color: #dceeff;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-spoiler {
    background: #46515d;
    color: #dce5ee;
}

:is(html[data-theme="dark"], body[data-theme="dark"], body.dark-theme, body.theme-dark) .comment-spoiler.is-open {
    background: #35404b;
    color: var(--so-text);
}

@media (max-width: 520px) {
    .comment-format-toolbar {
        width: 100%;
        flex-wrap: wrap;
    }

    .comment-reaction-popover {
        left: auto;
        right: 0;
        width: min(304px, calc(100vw - 24px));
    }

    .comment-sticker-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}
