/*! web-calculator.ru © 2022-2026 — авторский код, копирование запрещено. src:rd-drobi-kalk.css */
/* Сокращение, сравнение, степень дроби и перевод десятичной дроби в новом дизайне. Скрипты страниц прежние;
   drobi.css, sravnenie-drobej.css, stepen-drobi.css, perevod-drobej.css и inputs-style.css сюда не подключаем,
   нужные из них правила повторены ниже в языке rd-drobi.css. */

/* ---------- доска ---------- */
.rd #simple-calc .fraction-wrapper { margin: 0; }
.rd #simple-calc .frac-board { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-radius: 22px; background: var(--pill); }
.rd #simple-calc .frac-term { display: grid; grid-template-columns: auto auto; grid-template-areas: "sel sel" "ctl row"; align-items: center; gap: 10px 10px; padding: 14px; border-radius: 18px; background: var(--tile); position: relative; }
.rd #simple-calc .frac-term > .frac-caption { display: none; }
.rd #simple-calc .frac-toggle,
.rd #simple-calc .t-type-select { grid-area: sel; justify-self: start; }
.rd #simple-calc .frac-term > .frac-row { grid-area: row; }
.rd #simple-calc .frac-term > .change_sign { grid-area: ctl; }
.rd #simple-calc .t-type-select {
    display: block; height: 32px; padding: 0 30px 0 12px; border: 0; border-radius: 999px; background: var(--pill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230D0D0D' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--ink); font: 500 13px/1 var(--f-ui); -webkit-appearance: none; appearance: none; cursor: pointer;
}
.rd #simple-calc .t-type-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* переключатель «Простая / Смешанная» у сокращения: сегмент-пилюля, радио спрятаны */
.rd #simple-calc .frac-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--pill); }
.rd #simple-calc .frac-toggle label,
.rd #simple-calc .radio-group label { position: relative; display: inline-flex; align-items: center; margin: 0; border-radius: 999px; color: var(--ink); cursor: pointer; white-space: nowrap; transition: background .15s; }
.rd #simple-calc .frac-toggle label { height: 32px; padding: 0 14px; font: 500 13px/1 var(--f-ui); }
.rd #simple-calc .frac-toggle input,
.rd #simple-calc .radio-group input { position: absolute; width: 0; height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.rd #simple-calc :is(.frac-toggle, .radio-group) label:hover { background: var(--accent-soft); }
.rd #simple-calc :is(.frac-toggle, .radio-group) label:has(input:checked) { background: #fff; box-shadow: 0 1px 3px rgba(13, 13, 13, .08); }
.rd #simple-calc :is(.frac-toggle, .radio-group) label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* у сравнения тип выбирается списком, радио остаются для скрипта */
.rd #calc_sravnenie .frac-toggle { display: none; }

.rd #simple-calc .frac-row { display: flex; align-items: center; gap: 8px; }
.rd #simple-calc .frac-whole { display: none; }
.rd #simple-calc .frac-stack { display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 64px; }
.rd #simple-calc .frac-bar { display: block; height: 2px; width: 100%; border-radius: 2px; background: var(--ink); }
.rd #simple-calc .frac-dec-wrap { display: none; align-items: center; justify-content: center; }
.rd #simple-calc .val_fraction {
    width: 64px; height: 46px; padding: 0 4px; box-sizing: border-box; border: 0; border-radius: 12px; background: var(--pill);
    color: var(--ink); font: 600 20px/1 var(--f-ui); text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.rd #simple-calc .frac-stack .val_fraction { width: 100%; }
.rd #simple-calc .input-small { width: 52px; }
.rd #simple-calc .t-dec { width: 110px; }
.rd #simple-calc .val_fraction:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.rd #simple-calc .val_fraction::placeholder { color: var(--mute); font-weight: 400; }
.rd #simple-calc .fr-sign { display: none; font: 600 24px/1 var(--f-ui); color: var(--ink); }

.rd #simple-calc .change_sign { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--pill); color: var(--ink); font-size: 0; cursor: pointer; }
.rd #simple-calc .change_sign::after { content: "±"; font: 500 18px/1 var(--f-ui); }
.rd #simple-calc .change_sign:hover { background: var(--accent-soft); }
.rd #simple-calc .change_sign:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rd #simple-calc .frac-eq { display: flex; align-items: center; justify-content: center; }
.rd #simple-calc .equal-sign { font: 500 28px/1 var(--f-ui); color: var(--mute); }

/* результат сокращения на доске */
.rd #simple-calc .frac-result { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; background: var(--tile); box-shadow: inset 0 0 0 2px var(--accent); }
.rd #simple-calc .frac-result > .frac-caption { display: block; font: 400 11px/1.2 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.rd #simple-calc .frac-result .val_fraction { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent-mid); color: var(--accent); cursor: default; }
.rd #simple-calc .frac-result #res_int { width: 52px; background: transparent; box-shadow: none; font-size: 34px; }
.rd #simple-calc .frac-result .frac-bar { background: var(--accent); }
.rd #simple-calc .frac-result .fr-sign { color: var(--accent); }
.rd #simple-calc .frac-result.is-whole .frac-bar,
.rd #simple-calc .frac-result.is-whole #res_den { display: none; }
.rd #simple-calc .frac-result.is-whole #res_num { background: transparent; box-shadow: none; font-size: 34px; }

/* знак сравнения */
.rd #simple-calc .frac-cmp { display: flex; align-items: center; justify-content: center; }
.rd #simple-calc .cmp-sign { display: inline-block; min-width: 34px; font: 700 34px/1 var(--f-ui); text-align: center; color: var(--accent); }
.rd #simple-calc .cmp-sign.is-empty { color: var(--mute); }

/* степень: скобки, показатель, режим десятичных */
.rd #simple-calc .radio-group { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 100%; margin: 0 0 16px; padding: 4px; border-radius: 999px; background: var(--pill); }
.rd #simple-calc .radio-group label { height: 40px; padding: 0 18px; font: 500 14px/1 var(--f-ui); }
.rd #simple-calc .pow-board { gap: 4px; }
.rd #simple-calc .pow-board .frac-term { grid-template-areas: "ctl row"; }
.rd #simple-calc .pow-board .frac-whole { display: block; }
.rd #simple-calc .pow-paren { align-self: center; margin: 0 2px; font: 300 58px/1 var(--f-ui); color: var(--ink); -webkit-user-select: none; user-select: none; }
.rd #simple-calc .pow-exp { align-self: flex-start; }
.rd #simple-calc .pow-exp-input { width: 48px; height: 44px; }
/* показатель стоит прямо на доске, фон как у термов, иначе поле сливается с доской */
.rd #simple-calc .pow-exp .val_fraction { background: var(--tile); }
.rd #simple-calc .dec-input { width: 120px; }

/* строки для скринридера */
.rd #simple-calc :is(.sd-sr, .cmp-sr, .pow-sr) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ошибка сокращения — как .calc-error основы */
.rd #simple-calc #error-message.frac-err { margin: 14px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--bad-soft); font: 500 14px/1.45 var(--f-ui); color: var(--bad); text-align: left; }
.rd #simple-calc #calc_sravnenie .calc-error,
.rd #simple-calc #calc_stepen .calc-error { margin: 14px 0 0; }
.rd #simple-calc :is(#error-message, .calc-error) a { color: inherit; text-decoration: underline; }

/* ---------- кнопки, действия, примеры ---------- */
.rd #simple-calc .btn-wrapper1 { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.rd #simple-calc .btn-r,
.rd #simple-calc .btn-c { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; height: 48px; padding: 0 28px; border: 0; border-radius: 999px; font: 600 15px/1 var(--f-ui); cursor: pointer; transition: opacity .15s; }
.rd #simple-calc .btn-r { background: var(--ink); color: #fff; }
.rd #simple-calc .btn-c { background: var(--pill); color: var(--ink); }
.rd #simple-calc .btn-r:hover,
.rd #simple-calc .btn-c:hover { opacity: .85; }
.rd #simple-calc :is(.btn-r, .btn-c):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rd #simple-calc .calc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.rd #simple-calc .calc-actions[hidden] { display: none; }
.rd #simple-calc .btn-mini { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--pill); color: var(--ink); font: 500 13px/1 var(--f-ui); cursor: pointer; }
.rd #simple-calc .btn-mini:hover { background: var(--accent-soft); }

.rd #simple-calc .frac-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0 0; }
.rd #simple-calc .frac-chips__label { margin: 0 6px 0 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc .frac-chip { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--pill); color: var(--ink); font: 500 13px/1 var(--f-mono); cursor: pointer; white-space: nowrap; transition: background .15s; }
.rd #simple-calc .frac-chip:hover { background: var(--accent-soft); }
.rd #simple-calc :is(.frac-chip, .btn-mini, .hist-clear, .hist-item):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* история */
.rd #simple-calc .frac-history { margin: 20px 0 0; }
.rd #simple-calc .frac-history[hidden] { display: none; }
.rd #simple-calc .hist-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.rd #simple-calc .hist-title { font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc .hist-clear { min-height: 32px; padding: 6px 8px; border: 0; background: none; color: var(--accent); font: 500 13px/1 var(--f-ui); cursor: pointer; }
.rd #simple-calc .hist-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rd #simple-calc .hist-list li { margin: 0; padding: 0; list-style: none; }
.rd #simple-calc .hist-list li::before { content: none; }
.rd #simple-calc .hist-item { width: 100%; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--tile); color: var(--ink); font: 400 14px/1.3 var(--f-mono); text-align: left; cursor: pointer; }
.rd #simple-calc .hist-item:hover { background: var(--accent-soft); }
.rd #simple-calc .hist-eq { margin: 0 4px; color: var(--mute); }
.rd #simple-calc .hist-item b { color: var(--accent); font-weight: 600; }

.rd .frac-toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: #fff; font: 500 14px/1.3 var(--f-ui); opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); transition: opacity .2s, transform .2s; }
.rd .frac-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- решение ---------- */
.rd #simple-calc .div_s { margin: 24px 0 0; padding: 24px; border-radius: 22px; background: var(--tile); }
.rd #simple-calc .div_s:has(#decision:empty) { display: none; }
.rd #simple-calc .div_s_header { display: block; margin: 0 0 12px; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc #decision { display: flex; flex-direction: column; gap: 14px; font: 400 15px/1.5 var(--f-ui); color: var(--ink); overflow-wrap: anywhere; }
.rd #simple-calc #decision br { display: none; }
.rd #simple-calc #decision p { display: block; margin: 0; }
.rd #simple-calc #decision b,
.rd #simple-calc #decision strong { font-weight: 600; }
.rd #simple-calc #decision sup { font-size: 70%; }
.rd #simple-calc .fraction1 { display: inline-block; vertical-align: middle; text-align: center; margin: 0 .2em; }
.rd #simple-calc .numerator,
.rd #simple-calc .denominator { display: block; }
.rd #simple-calc .fraction-line { display: block; border-bottom: 1px solid currentColor; margin: 1px 0; min-width: 1em; }
.rd #simple-calc .mixed-number { display: inline-flex; align-items: center; }
.rd #simple-calc .whole { margin-right: .25em; }

/* ---------- перевод десятичной дроби (партиал drob-conv-widget) ---------- */
.rd #simple-calc #drob-conv { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; max-width: none; }
.rd #simple-calc #dc-panel-frac .form-group__wrapper { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.rd #simple-calc .dc-hint { display: block; margin: 0; font: 400 13px/1.45 var(--f-ui); color: var(--mute); }
.rd #simple-calc .dc-hint:empty { display: none; }
.rd #simple-calc .dc-neg { display: inline-flex; align-items: center; gap: 10px; margin: 14px 0 0; font: 500 14px/1.3 var(--f-ui); color: var(--ink); cursor: pointer; }
.rd #simple-calc .dc-neg input[type="checkbox"] {
    all: revert; display: inline-block !important; -webkit-appearance: auto !important; appearance: auto !important; box-sizing: border-box;
    width: 18px !important; height: 18px !important; min-width: 18px; flex: none; margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: none !important; accent-color: var(--accent); cursor: pointer;
}
.rd #simple-calc #dc-res-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rd #simple-calc .dc-res-label { font-weight: 400; }
.rd #simple-calc .dc-alt { font: 400 15px/1.4 var(--f-ui); color: var(--mute); }
.rd #simple-calc #dc-res-steps { font: 400 15px/1.6 var(--f-ui); color: var(--ink); }
.rd #simple-calc .dc-step { margin: 0 0 8px; }
.rd #simple-calc .dc-step:last-child { margin-bottom: 0; }
.rd #simple-calc #dc-res-steps b { font-weight: 600; }
.rd #simple-calc .dc-f { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.15; }
.rd #simple-calc .dc-f-n,
.rd #simple-calc .dc-f-d { padding: 0 .3em; }
.rd #simple-calc .dc-f-l { align-self: stretch; margin: 2px 0; border-bottom: 2px solid currentColor; }
.rd #simple-calc .dc-m { display: inline-flex; align-items: center; gap: .25em; }
.rd #simple-calc #dc-res-main .dc-f { font-size: .7em; }
.rd #simple-calc #dc-result .rz-chip { margin: 16px 0 0; }
.rd #simple-calc .dc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.rd #simple-calc .dc-chips__label { flex: 0 0 100%; margin: 0 0 2px; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc .dc-chip { width: auto; }
.rd #simple-calc .dc-toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: #fff; font: 500 14px/1.3 var(--f-ui); opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); transition: opacity .2s, transform .2s; }
.rd #simple-calc .dc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- таблицы статей ---------- */
html body.rd .dc-table-wrap { margin: 24px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
html body.rd .dc-table-wrap > table { margin: 0; }
html body.rd .cmp-table td:nth-child(2) { text-align: center; font-weight: 700; color: var(--accent); }
html body.rd .cmp-table :is(th, td):nth-child(-n+3) { white-space: nowrap; }
html body.rd .pow-table td:nth-child(3) { font-weight: 700; color: var(--accent); }
html body.rd .pow-table sup { font-size: 70%; }

/* ---------- телефон ---------- */
@media (max-width: 639px) {
    .rd #simple-calc .frac-board { gap: 8px; padding: 10px; border-radius: 18px; }
    .rd #simple-calc .frac-term { flex: 1 1 0; min-width: 0; grid-template-columns: 1fr; grid-template-areas: "sel" "row" "ctl"; justify-items: center; gap: 8px; padding: 10px 8px; border-radius: 16px; }
    .rd #simple-calc :is(.frac-toggle, .t-type-select) { justify-self: center; }
    .rd #simple-calc .frac-row { gap: 6px; }
    .rd #simple-calc .frac-stack { width: 52px; }
    .rd #simple-calc .val_fraction { width: 52px; height: 42px; font-size: 18px; }
    .rd #simple-calc .input-small { width: 40px; }
    .rd #simple-calc .t-dec { width: 88px; }
    .rd #simple-calc .change_sign { width: 32px; height: 32px; }
    .rd #simple-calc .frac-eq { display: none; }
    .rd #simple-calc .frac-result { flex: 1 1 100%; flex-direction: row; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px; }
    .rd #simple-calc .frac-result::before { content: "="; order: -1; font: 500 26px/1 var(--f-ui); color: var(--accent); }
    .rd #simple-calc .frac-result > .frac-caption { order: -2; }
    .rd #simple-calc .frac-result #res_int,
    .rd #simple-calc .frac-result.is-whole #res_num { font-size: 28px; }
    .rd #simple-calc .cmp-sign { min-width: 28px; font-size: 28px; }

    .rd #simple-calc .radio-group { display: flex; margin-bottom: 14px; }
    .rd #simple-calc .radio-group label { flex: 1 1 0; justify-content: center; height: 40px; padding: 0 12px; font-size: 13px; }
    .rd #simple-calc .pow-board { flex-wrap: nowrap; justify-content: center; }
    .rd #simple-calc .pow-board .frac-term { flex: none; grid-template-areas: "row" "ctl"; }
    .rd #simple-calc .pow-paren { font-size: 46px; }
    .rd #simple-calc .pow-exp-input { width: 44px; }
    .rd #simple-calc .dec-input { width: 100px; }

    .rd #simple-calc .btn-wrapper1 { flex-direction: row; flex-wrap: nowrap; margin-top: 14px; }
    .rd #simple-calc .btn-r,
    .rd #simple-calc .btn-c { flex: 1 1 auto; min-width: 0; padding: 0 16px; white-space: nowrap; }
    .rd #simple-calc :is(.frac-chips, .dc-chips) { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; scrollbar-width: none; }
    .rd #simple-calc :is(.frac-chips, .dc-chips)::-webkit-scrollbar { display: none; }
    .rd #simple-calc :is(.frac-chips, .dc-chips) > * { flex: 0 0 auto; }
    .rd #simple-calc .dc-chips__label { flex: 0 0 auto; margin: 0 4px 0 0; }
    .rd #simple-calc .btn-mini { padding: 0 12px; font-size: 12px; }
    .rd #simple-calc .calc-actions { gap: 6px; }
    .rd #simple-calc .div_s { margin-top: 18px; padding: 18px 16px; border-radius: 18px; }
    .rd #simple-calc #dc-panel-frac .form-group__wrapper { gap: 10px; }
}
@media (max-width: 560px) {
    html body.rd .cmp-table :is(th, td):nth-child(4) { display: none; }
    /* без четвёртого столбца таблица узкая: ей не нужна прокрутка из redesign.css, пусть тянется на всю ширину */
    html body.rd .cmp-table { display: table; }
}
@media print {
    .rd #simple-calc :is(.frac-chips, .dc-chips, .calc-actions, .btn-wrapper1, .frac-history) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .rd .frac-toast, .rd #simple-calc .dc-toast { transition: none; }
}
