.rich-text-field {
    --border: var(--line, #d9d9d9);
    --surface-muted: var(--surface-2, #f7f7f7);
    --accent: var(--brand, #fcbd01);
    display: grid;
    position: relative;
    gap: 8px;
    min-width: 0;
}

.admin-shell .rich-text-field {
    --border: var(--admin-line);
    --surface: var(--admin-panel);
    --surface-muted: var(--admin-panel-2);
    --text: var(--admin-text);
    --muted: var(--admin-muted);
    --accent: var(--admin-brand);
}

.rich-text-field__label {
    color: var(--text, #171717);
    font-size: 13px;
    font-weight: 700;
}

.rich-text-field .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px 6px 0 0;
    background: var(--surface-muted, #f7f7f7);
    font-family: inherit;
}

.rich-text-toolbar-shell {
    display: flex;
    align-items: flex-start;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px 6px 0 0;
    background: var(--surface-muted, #f7f7f7);
}

.rich-text-toolbar-shell .ql-toolbar.ql-snow {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
}

.rich-text-field .ql-toolbar.ql-snow .ql-formats {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0;
}

.rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header {
    flex: 0 0 142px;
    width: 142px;
}

.rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label,
.rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header .ql-picker-item::before {
    white-space: nowrap;
}

.rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header .ql-picker-options {
    min-width: 142px;
}

.rich-text-field .ql-toolbar.ql-snow button,
.rich-text-field .ql-toolbar.ql-snow select {
    min-width: 30px;
    min-height: 30px;
}

@media (hover: hover) and (pointer: fine) {
    .rich-text-field .ql-toolbar [data-tooltip] {
        position: relative;
    }

    .rich-text-field .ql-toolbar [data-tooltip]::after {
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        z-index: 80;
        max-width: min(240px, 70vw);
        border: 1px solid rgb(255 255 255 / 12%);
        border-radius: 5px;
        background: #111111;
        color: #ffffff;
        box-shadow: 0 8px 22px rgb(0 0 0 / 24%);
        content: attr(data-tooltip);
        opacity: 0;
        padding: 7px 9px;
        font: 700 12px/1.25 inherit;
        pointer-events: none;
        transform: translate(-50%, 3px);
        transition: opacity 140ms ease, transform 140ms ease;
        white-space: nowrap;
    }

    .rich-text-field .ql-toolbar [data-tooltip]:hover,
    .rich-text-field .ql-toolbar [data-tooltip]:focus-visible {
        z-index: 81;
    }

    .rich-text-field .ql-toolbar [data-tooltip]:hover::after,
    .rich-text-field .ql-toolbar [data-tooltip]:focus-visible::after {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    .rich-text-field .ql-toolbar .rich-text-toolbar__utility [data-tooltip]::after {
        right: 0;
        left: auto;
        transform: translateY(3px);
    }

    .rich-text-field .ql-toolbar .rich-text-toolbar__utility [data-tooltip]:hover::after,
    .rich-text-field .ql-toolbar .rich-text-toolbar__utility [data-tooltip]:focus-visible::after {
        transform: translateY(0);
    }
}

.rich-text-field .ql-container.ql-snow {
    min-height: 280px;
    border: 1px solid var(--border, #d9d9d9);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    background: var(--surface, #fff);
    color: var(--text, #171717);
    font-family: inherit;
    font-size: 16px;
}

.rich-text-field .ql-editor {
    --rich-editor-inline-padding: 20px;
    min-height: 280px;
    padding: 20px var(--rich-editor-inline-padding);
    font-family: var(--font-reading, var(--admin-font-reading, Georgia, serif));
    font-size: 18px;
    line-height: 1.76;
}

.rich-text-field .ql-editor.ql-blank::before {
    right: var(--rich-editor-inline-padding);
    left: var(--rich-editor-inline-padding);
    color: var(--muted, #727272);
    font-style: normal;
}

.rich-text-field .ql-editor h2,
.rich-text-field .ql-editor h3 {
    margin: 1.2em 0 0.5em;
    font-family: var(--font-headline, var(--admin-font-headline, "Arial Narrow", Arial, sans-serif));
    letter-spacing: -0.015em;
}

.rich-text-field .ql-editor blockquote {
    border-left: 4px solid var(--accent, #fcbd01);
    color: var(--muted, #606060);
}

.rich-text-field .ql-editor img {
    display: block;
    width: auto;
    max-width: min(100%, 720px);
    max-height: 520px;
    height: auto;
    margin: 22px auto;
    border: 1px solid color-mix(in srgb, var(--border, #d9d9d9) 82%, transparent);
    border-radius: 10px;
    background: var(--surface-muted, #f7f7f7);
    box-shadow: 0 12px 30px rgb(0 0 0 / 12%);
    object-fit: contain;
}

.rich-text-field .ql-editor iframe.ql-video {
    display: block;
    width: min(100%, 720px);
    aspect-ratio: 16 / 9;
    height: auto;
    margin: 22px auto;
    border: 1px solid color-mix(in srgb, var(--border, #d9d9d9) 82%, transparent);
    border-radius: 10px;
    background: #111111;
    box-shadow: 0 12px 30px rgb(0 0 0 / 16%);
}

.rich-text-field .ql-editor audio.ql-audio {
    display: block;
    width: min(100%, 680px);
    min-height: 54px;
    margin: 20px auto;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px;
    background: var(--surface-muted, #f7f7f7);
}

.rich-text-field .ql-editor audio.ql-audio {
    visibility: hidden;
    min-height: 84px;
}

.rich-text-audio-player {
    position: absolute;
    z-index: 5;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) minmax(112px, 154px) 46px;
    align-items: center;
    gap: 13px;
    min-height: 84px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent, #fcbd01) 24%, var(--border, #34312b));
    border-radius: 14px;
    background: linear-gradient(135deg, #24211b 0%, #181818 55%, #141414 100%);
    box-shadow: 0 16px 38px rgb(0 0 0 / 28%);
    color: #fff;
    padding: 14px 16px;
}

.rich-text-audio-player::after {
    position: absolute;
    top: -70px;
    right: -45px;
    width: 150px;
    height: 150px;
    border: 24px solid rgb(252 189 1 / 9%);
    border-radius: 50%;
    content: '';
    pointer-events: none;
}

.rich-text-audio-player button {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 12%);
    background: rgb(255 255 255 / 6%);
    color: #fff;
}

.rich-text-audio-player__play {
    width: 52px;
    height: 52px;
    border: 0 !important;
    border-radius: 50% !important;
    background: var(--accent, #fcbd01) !important;
    color: #111 !important;
    box-shadow: 0 10px 24px rgb(252 189 1 / 22%);
}

.rich-text-audio-player button svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.rich-text-audio-player__info {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.rich-text-audio-player__info strong {
    display: block;
    margin-bottom: 10px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-text-audio-player__timeline {
    display: grid;
    grid-template-columns: 36px minmax(70px, 1fr) 36px;
    align-items: center;
    gap: 9px;
    color: rgb(255 255 255 / 60%);
    font-size: 10px;
    font-weight: 700;
}

.rich-text-audio-player__timeline input {
    width: 100%;
    height: 4px;
    margin: 0;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent, #fcbd01) var(--audio-progress, 0%), rgb(255 255 255 / 18%) var(--audio-progress, 0%));
    cursor: pointer;
}

.rich-text-audio-player__progress::-webkit-slider-thumb {
    width: 0;
    height: 0;
    appearance: none;
    border: 0;
}

.rich-text-audio-player__progress::-moz-range-thumb {
    width: 0;
    height: 0;
    border: 0;
}

.rich-text-audio-player__volume {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 40px minmax(58px, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
}

.rich-text-audio-player__volume-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 9px 0;
}

.rich-text-audio-player__volume-track {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgb(255 255 255 / 20%);
    pointer-events: none;
    transform: translateY(-50%);
}

.rich-text-audio-player__volume-track::before {
    display: block;
    width: var(--audio-volume, 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--accent, #fcbd01);
    content: '';
}

.rich-text-audio-player__volume-panel input {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    opacity: 0;
}

.rich-text-audio-player__volume-panel input::-webkit-slider-thumb {
    width: 0;
    height: 0;
    appearance: none;
    border: 0;
    background: transparent;
}

.rich-text-audio-player__volume-panel input::-moz-range-thumb {
    width: 0;
    height: 0;
    border: 0;
    background: transparent;
}

.rich-text-audio-player__mute,
.rich-text-audio-player__speed {
    width: 40px;
    height: 38px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 800;
}

.rich-text-audio-player__mute.is-muted {
    color: var(--accent, #fcbd01);
    opacity: .55;
}

@media (max-width: 620px) {
    .rich-text-audio-player {
        grid-template-columns: 44px minmax(0, 1fr) minmax(94px, 118px);
        gap: 9px;
        padding: 12px;
    }

    .rich-text-audio-player__play {
        width: 44px;
        height: 44px;
    }

    .rich-text-audio-player__speed {
        display: none;
    }

    .rich-text-audio-player__volume {
        grid-template-columns: 38px minmax(48px, 1fr);
        gap: 6px;
    }
}

.rich-text-field .ql-toolbar button.ql-audio {
    display: grid;
    place-items: center;
    color: var(--text, #171717);
    font-size: 19px;
    font-weight: 700;
}

.rich-text-field .ql-editor a {
    border-radius: 3px;
    color: color-mix(in srgb, var(--accent, #fcbd01) 68%, var(--text, #171717));
    font-weight: 700;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
    overflow-wrap: anywhere;
}

.rich-text-field .ql-editor a:hover {
    background: color-mix(in srgb, var(--accent, #fcbd01) 12%, transparent);
    text-decoration-color: currentColor;
}

.rich-text-field .ql-editor .ql-code-block-container {
    position: relative;
    border: 1px solid #3a3833;
    border-radius: 6px;
    background: #1d1c19;
    color: #e8e6df;
    box-shadow: 0 10px 26px rgb(0 0 0 / 12%);
    padding: 56px 16px 14px;
    font: 14px/1.65 Consolas, "Courier New", monospace;
    tab-size: 4;
}

.rich-text-code-language {
    position: absolute;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 100%;
    box-sizing: border-box;
}

.rich-text-code-language[hidden] {
    display: none;
}

.rich-text-code-language__detect {
    min-height: 34px;
    border: 1px solid #4b4943;
    border-radius: 5px;
    background: #fcbd01;
    color: #111111;
    padding: 5px 11px;
    font: 800 12px/1.2 inherit;
    cursor: pointer;
}

.rich-text-code-language__detect:hover,
.rich-text-code-language__detect:focus-visible {
    background: #ffd253;
}

@media (max-width: 640px) {
    .rich-text-code-language {
        flex-wrap: wrap;
    }

    .custom-select--editor-language {
        flex: 1 1 150px;
        width: auto;
        min-width: 0;
    }

    .rich-text-code-language__detect {
        flex: 1 1 auto;
    }

    .rich-text-toolbar-shell {
        flex-wrap: wrap;
    }
}

.rich-text-field .ql-code-block-container > select.ql-ui {
    display: none !important;
}

.rich-text-field .ql-editor .hljs-comment,
.rich-text-field .ql-editor .hljs-quote {
    color: #8b918a;
    font-style: italic;
}

.rich-text-field .ql-editor .hljs-keyword,
.rich-text-field .ql-editor .hljs-selector-tag,
.rich-text-field .ql-editor .hljs-literal,
.rich-text-field .ql-editor .hljs-section,
.rich-text-field .ql-editor .hljs-link {
    color: #f07886;
}

.rich-text-field .ql-editor .hljs-string,
.rich-text-field .ql-editor .hljs-title,
.rich-text-field .ql-editor .hljs-name,
.rich-text-field .ql-editor .hljs-type,
.rich-text-field .ql-editor .hljs-attribute,
.rich-text-field .ql-editor .hljs-symbol,
.rich-text-field .ql-editor .hljs-bullet,
.rich-text-field .ql-editor .hljs-addition {
    color: #a8d878;
}

.rich-text-field .ql-editor .hljs-number,
.rich-text-field .ql-editor .hljs-meta,
.rich-text-field .ql-editor .hljs-built_in,
.rich-text-field .ql-editor .hljs-builtin-name,
.rich-text-field .ql-editor .hljs-doctag {
    color: #e5b75d;
}

.rich-text-field .ql-editor .hljs-variable,
.rich-text-field .ql-editor .hljs-template-variable,
.rich-text-field .ql-editor .hljs-selector-id,
.rich-text-field .ql-editor .hljs-selector-class,
.rich-text-field .ql-editor .hljs-function .hljs-title {
    color: #79b8e8;
}

.rich-text-field .ql-editor .hljs-regexp,
.rich-text-field .ql-editor .hljs-selector-attr,
.rich-text-field .ql-editor .hljs-selector-pseudo,
.rich-text-field .ql-editor .hljs-template-tag {
    color: #d4a6ff;
}

.rich-text-toolbar__utility {
    margin-left: auto !important;
}

.rich-text-field .ql-toolbar button.rich-text-toolbar__button {
    width: auto;
    min-width: 32px;
    padding: 0 7px;
    color: var(--text, #171717);
    font: 700 15px/1 inherit;
}

.rich-text-field .ql-toolbar button.rich-text-toolbar__source {
    min-width: 48px;
    font-size: 11px;
}

.rich-text-field .ql-toolbar button.rich-text-toolbar__button:hover,
.rich-text-field .ql-toolbar button.rich-text-toolbar__button[aria-pressed="true"] {
    color: #111;
    background: var(--accent, #fcbd01);
}

.rich-text-source {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    padding: 18px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 0 0 6px 6px;
    background: var(--surface, #fff);
    color: var(--text, #171717);
    font: 14px/1.65 Consolas, "Courier New", monospace;
    tab-size: 2;
}

.rich-text-source--enhanced[hidden] {
    display: none;
}

.rich-text-field.is-source-mode .ql-container {
    display: none;
}

.rich-text-field.is-source-mode .ql-toolbar > .ql-formats:not(.rich-text-toolbar__utility) {
    pointer-events: none;
    opacity: 0.35;
}

.rich-text-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 20px;
}

.rich-text-count,
.rich-text-error {
    color: var(--muted, #727272);
    font-size: 12px;
}

.rich-text-error {
    color: #b42318;
    font-weight: 700;
}

.rich-text-field.has-error .ql-toolbar,
.rich-text-field.has-error .ql-container,
.rich-text-field.has-error .rich-text-source {
    border-color: #b42318;
}

html.rich-text-fullscreen-open,
body.rich-text-fullscreen-open,
html.rich-text-dialog-open,
body.rich-text-dialog-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.rich-text-video-dialog {
    --border: var(--line, #d9d9d9);
    --surface-muted: var(--surface-2, #f7f7f7);
    --accent: var(--brand, #fcbd01);
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.admin-shell .rich-text-video-dialog {
    --border: var(--admin-line);
    --surface: var(--admin-panel);
    --surface-muted: var(--admin-panel-2);
    --text: var(--admin-text);
    --muted: var(--admin-muted);
    --accent: var(--admin-brand);
}

.rich-text-video-dialog[hidden] {
    display: none;
}

.rich-text-video-dialog__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(5px);
}

.rich-text-video-dialog__panel {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(520px, 100%);
    gap: 14px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 8px;
    background: var(--surface, #ffffff);
    color: var(--text, #171717);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
    padding: 22px;
}

.rich-text-video-dialog__panel h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: 0;
}

.rich-text-video-dialog__panel > p {
    margin: 0;
    color: var(--muted, #727272);
    font-size: 14px;
    line-height: 1.55;
}

.rich-text-video-dialog__panel input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px;
    background: var(--surface, #ffffff);
    color: var(--text, #171717);
    padding: 0 13px;
    font: inherit;
}

.rich-text-video-dialog__panel input:focus {
    outline: 0;
    border-color: var(--accent, #fcbd01);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #fcbd01) 20%, transparent);
}

.rich-text-video-dialog__error {
    color: #b42318 !important;
    font-weight: 700;
}

.rich-text-video-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.rich-text-video-dialog__actions button {
    min-height: 40px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px;
    background: var(--surface-muted, #f7f7f7);
    color: var(--text, #171717);
    padding: 0 15px;
    font-weight: 700;
}

.rich-text-video-dialog__actions button[type="submit"] {
    border-color: var(--accent, #fcbd01);
    background: var(--accent, #fcbd01);
    color: #111111;
}

.rich-text-field .ql-tooltip {
    display: none !important;
}

.rich-text-link-dialog__remove {
    margin-right: auto;
    border-color: color-mix(in srgb, #d94444 55%, var(--border, #d9d9d9)) !important;
    color: #d94444 !important;
}

.rich-text-field.is-fullscreen {
    position: fixed;
    inset: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px;
    background: var(--surface, #fff);
    box-shadow: 0 24px 80px rgb(0 0 0 / 28%);
}

.rich-text-field.is-fullscreen .ql-container,
.rich-text-field.is-fullscreen .rich-text-source {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.rich-text-field.is-fullscreen .ql-editor {
    min-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.rich-text-field.is-fullscreen .rich-text-source {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.rich-text-fullscreen-actions {
    display: none;
}

.rich-text-field.is-fullscreen .rich-text-fullscreen-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 -16px -16px;
    border-top: 1px solid var(--border, #d9d9d9);
    border-radius: 0 0 6px 6px;
    background: var(--surface, #ffffff);
    box-shadow: 0 -10px 28px rgb(0 0 0 / 14%);
    padding: 12px 16px;
}

.rich-text-fullscreen-actions button {
    min-height: 42px;
    border: 1px solid var(--border, #d9d9d9);
    border-radius: 6px;
    padding: 0 16px;
    font-weight: 700;
}

.rich-text-fullscreen-actions__close {
    background: var(--surface-muted, #f7f7f7);
    color: var(--text, #171717);
}

.rich-text-fullscreen-actions__save {
    border-color: var(--accent, #fcbd01) !important;
    background: var(--accent, #fcbd01);
    color: #111111;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent, #fcbd01) 24%, transparent);
}

.rich-text-fullscreen-actions__save:hover,
.rich-text-fullscreen-actions__save:focus-visible {
    background: color-mix(in srgb, var(--accent, #fcbd01) 86%, #ffffff);
}

@media (max-width: 640px) {
    .rich-text-field.is-fullscreen {
        inset: 8px;
        padding: 10px;
    }

    .rich-text-field.is-fullscreen .rich-text-fullscreen-actions {
        margin: 0 -10px -10px;
        padding: 10px;
    }
}

[data-theme="dark"] .rich-text-field .ql-stroke {
    stroke: #efefef;
}

[data-theme="dark"] .rich-text-field .ql-fill {
    fill: #efefef;
}

[data-theme="dark"] .rich-text-field .ql-picker {
    color: #efefef;
}

[data-theme="dark"] .rich-text-field .ql-picker-options {
    background: #202020;
}

html[lang="ru"] .rich-text-field .ql-tooltip[data-mode="link"]::before {
    content: "Введите ссылку:";
}

html[lang="ru"] .rich-text-field .ql-tooltip a.ql-action::after {
    content: "Изменить";
}

html[lang="ru"] .rich-text-field .ql-tooltip.ql-editing a.ql-action::after {
    content: "Сохранить";
}

html[lang="ru"] .rich-text-field .ql-tooltip a.ql-remove::before {
    content: "Удалить";
}

html[lang="kk"] .rich-text-field .ql-tooltip[data-mode="link"]::before,
html[lang="kz"] .rich-text-field .ql-tooltip[data-mode="link"]::before {
    content: "Сілтемені енгізіңіз:";
}

html[lang="kk"] .rich-text-field .ql-tooltip a.ql-action::after,
html[lang="kz"] .rich-text-field .ql-tooltip a.ql-action::after {
    content: "Өзгерту";
}

html[lang="kk"] .rich-text-field .ql-tooltip.ql-editing a.ql-action::after,
html[lang="kz"] .rich-text-field .ql-tooltip.ql-editing a.ql-action::after {
    content: "Сақтау";
}

html[lang="kk"] .rich-text-field .ql-tooltip a.ql-remove::before,
html[lang="kz"] .rich-text-field .ql-tooltip a.ql-remove::before {
    content: "Жою";
}

@media (max-width: 720px) {
    .rich-text-field .ql-toolbar.ql-snow {
        gap: 2px;
        padding: 6px;
    }

    .rich-text-toolbar__utility {
        padding-top: 4px;
    }

    .rich-text-field .ql-container.ql-snow,
    .rich-text-field .ql-editor,
    .rich-text-source {
        min-height: 240px;
    }

    .rich-text-field.is-fullscreen {
        inset: 0;
        padding: 8px;
        border: 0;
        border-radius: 0;
    }
}

@media (max-width: 720px) {
    .rich-text-field__label,
    .rich-text-meta {
        justify-content: center;
        text-align: center;
    }

    .rich-text-meta {
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .rich-text-toolbar-shell {
        justify-content: center;
    }

    .rich-text-field .ql-toolbar.ql-snow {
        justify-content: center;
        width: 100%;
    }

    .rich-text-field .ql-toolbar.ql-snow .ql-formats {
        justify-content: center;
    }

    .rich-text-toolbar__utility {
        justify-content: center;
        width: 100%;
        margin: 2px 0 0 !important;
        border-top: 1px solid var(--border, #d9d9d9);
        padding-top: 7px;
    }

    .rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header {
        flex-basis: min(180px, 100%);
        width: min(180px, 100%);
    }

    .rich-text-field .ql-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label {
        text-align: center;
    }

    .rich-text-field .ql-editor img,
    .rich-text-field .ql-editor iframe.ql-video,
    .rich-text-field .ql-editor video.ql-uploaded-video,
    .rich-text-field .ql-editor audio.ql-audio {
        margin-right: auto;
        margin-left: auto;
    }

    .rich-text-audio-player {
        text-align: center;
    }

    .rich-text-audio-player__info strong {
        text-align: center;
    }

    .rich-text-audio-player__timeline {
        justify-content: center;
    }

    .rich-text-video-dialog__panel {
        justify-items: center;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        padding: 20px 16px;
        text-align: center;
    }

    .rich-text-video-dialog__panel input {
        text-align: center;
    }

    .rich-text-video-dialog__actions {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .rich-text-video-dialog__actions button {
        flex: 1 1 120px;
        max-width: 190px;
    }

    .rich-text-link-dialog__remove {
        margin-right: 0;
    }

    .rich-text-code-language {
        justify-content: center;
    }

    .rich-text-field.is-fullscreen .rich-text-fullscreen-actions {
        justify-content: center;
    }
}

@media (max-width: 430px) {
    .rich-text-field .ql-toolbar.ql-snow {
        padding: 7px 4px;
    }

    .rich-text-field .ql-toolbar.ql-snow .ql-formats {
        flex-wrap: wrap;
    }

    .rich-text-audio-player {
        grid-template-columns: 42px minmax(0, 1fr) minmax(86px, 102px);
        gap: 7px;
        padding: 10px;
    }

    .rich-text-audio-player__play {
        width: 42px;
        height: 42px;
    }

    .rich-text-audio-player__timeline {
        grid-template-columns: 30px minmax(44px, 1fr) 30px;
        gap: 5px;
    }

    .rich-text-field .ql-editor img,
    .rich-text-field .ql-editor video.ql-uploaded-video {
        max-height: 360px;
    }

    .rich-text-video-dialog__actions button {
        flex-basis: 100%;
        max-width: none;
    }
}
[data-rich-text-field] {
    position: relative;
}

.rich-text-field .ql-editor video.ql-uploaded-video,
.rich-text-field .ql-editor audio.ql-audio {
    display: block;
    width: min(100%, 720px);
    margin: 22px auto;
}

.rich-text-field .ql-editor video.ql-uploaded-video {
    aspect-ratio: 16 / 9;
    max-height: 520px;
    border: 1px solid color-mix(in srgb, var(--border, #d9d9d9) 82%, transparent);
    border-radius: 10px;
    background: #090909;
    box-shadow: 0 12px 30px rgb(0 0 0 / 16%);
    object-fit: contain;
}

.rich-text-field .ql-editor .is-editor-media-selected {
    outline: 3px solid var(--accent, #fcbd01);
    outline-offset: 3px;
}

.rich-text-media-actions {
    position: absolute;
    z-index: 20;
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgb(255 255 255 / 16%);
    border-radius: 6px;
    background: #171717;
    box-shadow: 0 8px 24px rgb(0 0 0 / 36%);
}

.rich-text-media-actions[hidden] {
    display: none;
}

.rich-text-media-actions__button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 4px;
    background: #272727;
    color: #ffffff;
    font-size: 20px;
}

.rich-text-media-actions__button:hover,
.rich-text-media-actions__button:focus-visible {
    background: var(--accent, #fcbd01);
    color: #111111;
}

.rich-text-field .ql-toolbar button.ql-media-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: inherit;
}

.rich-text-field .ql-toolbar button.ql-media-upload svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.rich-text-field .ql-toolbar button.ql-media-upload .ql-stroke {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.rich-text-field .ql-toolbar button.ql-media-upload:hover,
.rich-text-field .ql-toolbar button.ql-media-upload:focus-visible {
    color: var(--accent, #fcbd01);
}

.rich-text-field .ql-toolbar button.ql-media-upload.is-loading {
    cursor: wait;
    opacity: .55;
}
