.atomiq-reaction-output
{
    display: inline-flex;

    align-items: center;

    vertical-align: baseline;

    gap: .5em;
}

.atomiq-reaction-left,
.atomiq-reaction-right
{
    white-space: nowrap;
}

.atomiq-reaction-top
{
    margin-bottom: .15em;
}

.atomiq-reaction-bottom
{
    margin-top: .15em;
}
.atomiq-reaction-center {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch; /* Растягиваем дочерние элементы по ширине самого широкого текста (верх или низ) */
    justify-content: center;
    min-width: 4em;
    padding: 0 0.5em;
}

/* Надписи сверху и снизу определяют ширину блока */
.atomiq-reaction-top,
.atomiq-reaction-bottom {
    display: block;
    font-size: .92em;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    padding: 0 0.2em; /* Небольшой отступ, чтобы текст не прилипал к краям */
}

.atomiq-reaction-arrow
{
    display: block;

    width: 100%;

    margin: .4em 0;
}

.atomiq-reaction-arrow svg
{
    display: block;

    width: 100%;

    height: 14px;

    overflow: visible;
}

#atomiq-symbol-picker
{
    position: fixed;

    width: 320px;

	max-height: 420px;

	overflow-y: auto;

    background: white;

    border: 1px solid #ccc;

    border-radius: 6px;

    box-shadow: 0 8px 25px rgba(0,0,0,.25);

    z-index: 999999;
}

.atomiq-symbol-picker-body
{
    display: flex;

    flex-wrap: wrap;

    gap: 6px;

    padding: 10px;
}

.atomiq-symbol-button
{
    min-width: 34px;

    height: 34px;

    padding: 0 10px;

    border: 1px solid #8c8c8c;

    background: #f7f7f7;

    cursor: pointer;

    white-space: nowrap;

    font-size: 15px;
}

.atomiq-symbol-picker-tabs
{
    display: flex;

    gap: 4px;

    padding: 8px;

    border-bottom: 1px solid #ddd;

    overflow-x: auto;
}

.atomiq-symbol-tab
{
    padding: 6px 10px;

    border: 1px solid #ccc;

    background: #f7f7f7;

    cursor: pointer;

    white-space: nowrap;

    border-radius: 4px;
}

.atomiq-symbol-tab.active
{
    background: #2d7ff9;

    color: white;

    border-color: #2d7ff9;
}

.atomiq-symbol-picker-body
{
    display: flex;

    flex-wrap: wrap;

    gap: 6px;

    padding: 10px;
}

.atomiq-symbol-button
{
    min-width: 34px;

    height: 34px;

    padding: 0 10px;

    white-space: nowrap;
}

.atomiq-chain-stage
{
    display: inline;

    margin-left: 4px;

    font-size: 10px;

    color: #666;
}

.atomiq-chain-loop
{
    position: relative;

    margin-top: 20px;

    height: 60px;
}

.atomiq-chain-loop-line
{
    position: absolute;

    left: 20px;
    width: 250px;

    bottom: 0;

    height: 2px;

    background: #000;
}

.atomiq-chain-loop-head
{
    position: absolute;

    left: 20px;
    bottom: -5px;

    width: 8px;
    height: 8px;

    border-left: 2px solid #000;
    border-bottom: 2px solid #000;

    transform: rotate(45deg);
}

.atomiq-arrow-svg
{
    width:120px;
    height:14px;
    overflow:visible;
}

.atomiq-arrow-path
{
    stroke:#000;
    stroke-width:2;
    fill:none;
}

.atomiq-arrow-head
{
    stroke:#000;
    stroke-width:2;
    fill:none;
}

.atomiq-row
{
    display: flex;
    align-items: flex-start;
    gap: 40px;
    margin: 30px 0;
}

.atomiq-chain
{
    position: relative;

    /*
     * Renderer assigns the exact diagram width/height.
     * Keeping this as a block prevents the chain from flowing into
     * surrounding text while allowing its own intrinsic dimensions.
     */
    display: block;

    box-sizing: border-box;
}

.atomiq-layout
{
    position: relative;

    z-index: 2;
}

.atomiq-svg
{
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;

    z-index: 1;
}

/* =========================================================
   РЕДАКТОР ЦЕПОЧЕК
   ========================================================= */

/*
 * Размер полей FROM / TO.
 * TOP и BOTTOM здесь вообще не трогаем.
 */
#chain-reactions .reaction-from,
#chain-reactions .reaction-to
{
    width: 100% !important;
  min-height: 90px !important;
  padding: 10px !important;
  border: 1px solid #ced4da !important;
  border-radius: 4px !important;
  resize: vertical !important;
  box-sizing: border-box !important;
}


/*
 * Общий блок одной реакции.
 */
#chain-reactions .atomiq-builder
{
    position: relative;

    box-sizing: border-box;

    padding: 15px;

    margin-bottom: 10px;

    border-radius: 6px;

    border: 1px solid #ddd;
}


/*
 * Чередование фона реакций.
 */
#chain-reactions .atomiq-builder:nth-child(odd)
{
    background: #f3f3f3;
}


#chain-reactions .atomiq-builder:nth-child(even)
{
    background: #eef7fa;
}


/*
 * Кнопка удаления.
 */
#chain-reactions .atomiq-builder-delete
{
    position: absolute;

    top: 8px;
    right: 8px;

    z-index: 5;
}


/*
 * Чтобы кнопка удаления не перекрывала
 * рабочую область верхней части блока.
 */
#chain-reactions .atomiq-builder
{
    padding-right: 110px;
}

#atomiq-symbol-picker
{
    position: fixed;

    width: 360px;
    max-width: calc(100vw - 20px);

    max-height: 460px;

    display: flex;
    flex-direction: column;

    background: #ffffff;

    border: 1px solid #d8dee4;
    border-radius: 10px;

    box-shadow:
        0 12px 35px rgba(0, 0, 0, .20);

    z-index: 999999;

    overflow: hidden;
}


.atomiq-symbol-picker-header
{
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 10px 12px;

    background: #f7f9fb;

    border-bottom: 1px solid #e1e5e9;
}


.atomiq-symbol-picker-title
{
    font-size: 15px;
    font-weight: 600;
}


.atomiq-symbol-picker-close
{
    width: 28px;
    height: 28px;

    padding: 0;

    border: 0;
    border-radius: 6px;

    background: transparent;

    font-size: 22px;
    line-height: 1;

    cursor: pointer;
}


.atomiq-symbol-picker-close:hover
{
    background: #e9edf1;
}


.atomiq-symbol-picker-search
{
    padding: 10px 12px 8px;
}


.atomiq-symbol-picker-search input
{
    width: 100%;

    box-sizing: border-box;

    padding: 8px 10px;

    border: 1px solid #ccd3da;
    border-radius: 6px;

    outline: none;

    font-size: 14px;
}


.atomiq-symbol-picker-search input:focus
{
    border-color: #5A98A8;

    box-shadow:
        0 0 0 2px rgba(90, 152, 168, .15);
}


.atomiq-symbol-picker-tabs
{
    display: flex;

    gap: 4px;

    padding: 0 10px;

    border-bottom: 1px solid #e1e5e9;

    overflow-x: auto;

    scrollbar-width: thin;
}


.atomiq-symbol-tab
{
    flex: 0 0 auto;

    padding: 7px 10px;

    border: 0;

    border-bottom: 2px solid transparent;

    background: transparent;

    color: #444;

    cursor: pointer;

    white-space: nowrap;

    font-size: 13px;

    border-radius: 5px 5px 0 0;
}

.atomiq-symbol-tab:hover
{
    color: #222;

    background: #eef5f7;
}

.atomiq-symbol-tab.active
{
    background: #5A98A8;

    color: #ffffff;

    border-bottom-color: #5A98A8;

    font-weight: 600;
}


.atomiq-symbol-picker-body
{
    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    padding: 12px;

    overflow-y: auto;
}


.atomiq-symbol-button
{
    min-height: 38px;

    min-width: 44px;

    width: auto;

    padding: 5px 10px;

    border: 1px solid #d2d8dd;

    border-radius: 6px;

    background: #fafbfc;

    color: #222;

    cursor: pointer;

    font-size: 15px;

    white-space: nowrap;

    flex: 0 0 auto;

    transition:
        background .12s,
        border-color .12s,
        transform .08s;
}


.atomiq-symbol-button:hover
{
    background: #eef5f7;

    border-color: #9dbec7;
}


.atomiq-symbol-button:active
{
    transform: scale(.96);
}


.atomiq-symbol-button:hover
{
    background: #eef5f7;

    border-color: #9dbec7;
}


.atomiq-symbol-button:active
{
    transform: scale(.96);
}


.atomiq-symbol-empty
{
    grid-column: 1 / -1;

    padding: 25px 10px;

    text-align: center;

    color: #777;

    font-size: 14px;
}
/* ==========================================================
   Formula by valences — baseline aligned with surrounding text
   ========================================================== */
.atomiq-valence-formula {
    display: inline-block;
    vertical-align: baseline;
    white-space: nowrap;
    line-height: 1;
}

.atomiq-valence-unit {
    display: inline-block;
    position: relative;
    vertical-align: baseline;
    line-height: 1;
    white-space: nowrap;
}

.atomiq-valence-top {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    display: block;
    font-size: .88em;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.atomiq-valence-bottom {
    display: inline;
    line-height: 1;
    white-space: nowrap;
}

.atomiq-valence-bottom sub {
    font-size: .64em;
    vertical-align: -.25em;
}

.atomiq-valence-gap {
    display: inline-block;
    width: .16em;
    vertical-align: baseline;
}

/* Keep inline, display, and raw MathJax formulas at one readable size. */
.atomiq-math-inline,
.atomiq-math-display {
    font-size: 1em;
}

.atomiq-math-inline {
    vertical-align: middle;
}

.atomiq-math-display {
    display: block;
    margin: .65em 0;
    text-align: center;
}

.atomiq-math-inline mjx-container,
.atomiq-math-display mjx-container,
.iren-native-question-page mjx-container,
.iren-native-question-solution mjx-container,
.iren-native-review-question-content mjx-container,
.iren-native-admin-result-question-content mjx-container,
#question-list .question-preview mjx-container,
body.mce-content-body mjx-container {
    font-size: 1.4em !important;
}
