:root {
    color-scheme: light dark;
    --math-ink: #25362b;
    --math-muted: #738076;
    --math-green: #28543d;
    --math-green-2: #3e7853;
    --math-border: #e1e8df;
    --math-surface: #ffffff;
    --math-soft: #f6f8f4;
    --math-shadow: 0 16px 44px rgb(30 46 34 / 7%);
}
body {
    --math-green: var(--green-dark, #28543d);
    --math-green-2: var(--green, #3e7853);
    --math-green-hover: var(--green-hover, #2c6145);
    --math-green-rgb: var(--green-rgb, 54 114 81);
    --math-green-pale: var(--green-pale, #eaf2e9);
    --math-green-border: var(--green-border, #b9cfb8);
    --math-green-soft: var(--green-soft, #f3f8f1);
    margin: 0;
    background: #f3f5f0;
    color: var(--math-ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}
html[data-extratools-theme="blue"] body {
    --math-green: #24588f;
    --math-green-2: #3579bd;
    --math-green-hover: #2b68a5;
    --math-green-rgb: 53 121 189;
    --math-green-pale: #e8f1fc;
    --math-green-border: #a9c7e6;
    --math-green-soft: #f1f6fc;
}
html[data-extratools-theme="red"] body {
    --math-green: #983a35;
    --math-green-2: #c6534b;
    --math-green-hover: #ad453f;
    --math-green-rgb: 198 83 75;
    --math-green-pale: #faeceb;
    --math-green-border: #e3b9b6;
    --math-green-soft: #fcf2f1;
}
.math-shell { width: min(1060px, calc(100% - 40px)); margin: 28px auto 36px; }
.math-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.math-brand { display: inline-flex; align-items: center; gap: 10px; color: #314238; font-weight: 800; text-decoration: none; }
.math-brand-accent { color: var(--math-green-2); }
.math-header > p { margin: 0; color: #829085; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.math-hero { margin: 0 0 22px; }
.math-eyebrow, .math-section-label { margin: 0 0 9px; color: var(--math-green-2); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.math-hero h1 { margin: 0 0 13px; color: #23382b; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.035em; }
.math-intro { max-width: 850px; margin: 0; color: #5f6e62; font-size: 15px; line-height: 1.7; }
.math-seo-copy { max-width: 900px; margin: 8px 0 0; color: #778378; font-size: 13px; line-height: 1.65; }
:where(body[data-page="/calculations/percent-root/"]) .tool-breadcrumbs { display: block; width: 100%; margin: 0 0 clamp(12px, 1.7vw, 20px); color: #68756b; font: inherit; font-size: .88333rem; line-height: 1.5; }
:where(body[data-page="/calculations/percent-root/"]) .tool-breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: 0; list-style: none; }
:where(body[data-page="/calculations/percent-root/"]) .tool-breadcrumbs li + li::before { content: "/"; margin-right: .35rem; color: #9aa59b; }
:where(body[data-page="/calculations/percent-root/"]) .tool-breadcrumbs ol a { display: inline-flex; min-height: 31px; align-items: center; padding: .28rem .78rem; border: 1px solid var(--math-green-border); border-radius: 999px; background: var(--math-green-pale); box-shadow: 0 1px 2px rgb(37 76 55 / 8%); color: var(--math-green); font-weight: 750; text-decoration: none; transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
:where(body[data-page="/calculations/percent-root/"]) .tool-breadcrumbs ol a:hover { border-color: var(--math-green-2); background: var(--math-green-soft); color: var(--math-green-hover); }
.math-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.math-button, .math-tab, .math-copy, .math-dialog-close { font: inherit; }
.math-button { min-height: 39px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 750; }
.math-button--secondary { border-color: var(--math-green-border); background: #fff; color: var(--math-green); }
.math-button--primary, .math-button--calculate { background: var(--math-green); color: #fff; }
.math-button--primary:hover, .math-button--calculate:hover { background: var(--math-green-hover); }
.math-button:hover { filter: brightness(.97); }
.math-button:focus-visible, .math-tab:focus-visible, .math-copy:focus-visible, .math-dialog-close:focus-visible, .math-example:focus-visible { outline: 3px solid rgb(var(--math-green-rgb) / 35%); outline-offset: 2px; }
.math-mode-note { color: #718075; font-size: 11px; }
.math-card { margin-top: 18px; padding: clamp(18px, 3vw, 27px); border: 1px solid var(--math-border); border-radius: 16px; background: var(--math-surface); box-shadow: var(--math-shadow); }
.math-card-topline { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 14px; color: #879187; font-size: 9px; font-weight: 800; letter-spacing: .11em; }
.math-card h2 { margin: 0 0 19px; color: #25382b; font-size: 21px; }
.math-tabs { display: flex; gap: 7px; margin-bottom: 20px; padding: 4px; border: 1px solid #e5ebe3; border-radius: 10px; background: #f7f9f6; }
.math-tab { min-height: 38px; flex: 1; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: #637166; cursor: pointer; font-size: 12px; font-weight: 750; }
.math-tab.is-active { background: #fff; color: var(--math-green); box-shadow: 0 1px 5px rgb(32 47 35 / 12%); }
.math-panel { min-height: 300px; }
.math-field { display: grid; min-width: 0; gap: 7px; color: #425348; font-size: 11px; font-weight: 750; }
.math-field input, .math-field select, .math-field textarea { width: 100%; min-width: 0; box-sizing: border-box; min-height: 43px; padding: 10px 12px; border: 1px solid #dce4db; border-radius: 8px; outline: 0; background: #fff; color: #29382e; font: 500 14px/1.35 Inter, "Segoe UI", Arial, sans-serif; }
.math-field textarea { min-height: 95px; resize: vertical; font-family: ui-monospace, Consolas, monospace; }
.math-field input:focus, .math-field select:focus, .math-field textarea:focus { border-color: var(--math-green-2); box-shadow: 0 0 0 3px rgb(var(--math-green-rgb) / 11%); }
.math-operation-field { max-width: 620px; margin-bottom: 17px; }
.math-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 15px; margin-bottom: 16px; }
.math-fields[hidden], .math-panel[hidden], [data-advanced-operation][hidden] { display: none !important; }
.math-field--wide { grid-column: 1 / -1; }
.math-advanced-row { display: flex; align-items: end; gap: 18px; margin: 2px 0 16px; }
.math-precision { width: 155px; flex: 0 0 155px; }
.math-hint { margin: 0 0 4px; color: #829087; font-size: 11px; line-height: 1.5; }
.math-button--calculate { width: 100%; min-height: 43px; }
.math-status { min-height: 18px; margin: 10px 0 0; color: #6c796e; font-size: 12px; }
.math-status.is-error { color: #a3342d; }
.math-result { margin-top: 20px; padding: 17px 19px; border: 1px solid #e0e9df; border-radius: 12px; background: #f7faf6; }
.math-result-topline { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.math-result-topline h3 { margin: 0; font-size: 13px; }
.math-section-label { margin-bottom: 5px; font-size: 9px; }
.math-copy { min-height: 30px; padding: 5px 8px; border: 0; background: transparent; color: var(--math-green); cursor: pointer; font-size: 11px; }
.math-copy:disabled { cursor: default; opacity: .45; }
.math-result-value { display: block; margin-top: 13px; overflow-wrap: anywhere; color: var(--math-green); font-size: clamp(25px, 4vw, 36px); font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.math-result-detail { margin: 7px 0 0; color: #748176; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.math-example-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.math-example { display: grid; min-height: 90px; align-content: center; gap: 5px; padding: 12px; border: 1px solid #e4eae2; border-radius: 10px; background: #fbfcfa; color: inherit; text-align: left; cursor: pointer; }
.math-example:hover { border-color: var(--math-green-border); background: var(--math-green-soft); }
.math-example span, .math-example small { color: #758276; font-size: 10px; }
.math-example strong { font-size: 13px; }
.math-guide ul { display: grid; gap: 10px; margin: 0; padding-left: 20px; color: #657267; font-size: 12px; line-height: 1.65; }
.math-footer { display: flex; justify-content: space-between; gap: 20px; padding: 15px 2px; color: #879187; font-size: 10px; }
.math-dialog { width: min(570px, calc(100% - 32px)); max-height: min(80vh, 700px); padding: 22px; border: 1px solid #dfe7de; border-radius: 15px; background: #fff; color: var(--math-ink); box-shadow: 0 24px 90px rgb(18 32 23 / 28%); }
.math-dialog::backdrop { background: rgb(20 31 23 / 48%); backdrop-filter: blur(2px); }
.math-dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid #e6ebe4; }
.math-dialog-header p { margin: 2px 0 6px; color: #6f8a70; font-size: 9px; font-weight: 800; letter-spacing: .11em; }
.math-dialog-header h2 { margin: 0; font-size: 20px; }
.math-dialog-close { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid #e2e8e0; border-radius: 8px; background: #f9faf8; color: #526255; cursor: pointer; font-size: 22px; line-height: 1; }
.math-dialog-body { max-height: 60vh; overflow: auto; padding-top: 12px; }
.math-dialog-body h3 { margin: 13px 0 5px; color: #324a38; font-size: 14px; }
.math-dialog-body p, .math-error-message { margin: 0 0 10px; color: #657267; font-size: 12px; line-height: 1.65; }
.math-dialog--error { width: min(450px, calc(100% - 32px)); }
.math-error-message { margin-top: 16px; color: #8e302b; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
@media (max-width: 720px) {
    .math-shell { width: min(100% - 24px, 600px); margin-top: 17px; }
    .math-header { align-items: flex-start; }
    .math-header > p { max-width: 130px; text-align: right; line-height: 1.4; }
    .math-fields { grid-template-columns: 1fr; gap: 12px; }
    .math-field--wide { grid-column: auto; }
    .math-example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .math-advanced-row { align-items: start; flex-direction: column; gap: 8px; }
    .math-precision { width: 100%; flex-basis: auto; }
    .math-card-topline { font-size: 8px; }
}
@media (max-width: 390px) {
    .math-shell { width: calc(100% - 18px); }
    .math-card { padding: 15px; }
    .math-tabs { flex-direction: column; }
    .math-footer { flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
@media (prefers-color-scheme: dark) {
    body { background: #111713; color: #e1e8e1; }
    .math-brand, .math-hero h1, .math-card h2, .math-result-topline h3 { color: #e1e8e1; }
    .math-intro, .math-seo-copy, .math-mode-note, .math-hint, .math-guide ul { color: #a9b7aa; }
    .math-card, .math-dialog { background: #1b241e; border-color: #35433a; color: #e0e7e0; }
    .math-tabs, .math-example { background: #202a23; border-color: #35433a; }
    .math-tab { color: #b6c3b7; }
    .math-tab.is-active, .math-field input, .math-field select, .math-field textarea, .math-button--secondary { background: #161e19; color: var(--math-green-2); border-color: #39483e; }
    .math-result { background: #202c23; border-color: #3a4b3d; }
    .math-result-value { color: var(--math-green-2); }
    .math-result-detail, .math-example span, .math-example small, .math-card-topline { color: #a3b0a5; }
    .math-dialog-header { border-color: #35433a; }
    .math-dialog-body h3 { color: #b5d3b5; }
    .math-dialog-body p { color: #b4c0b5; }
    .math-dialog-close { background: #26312a; color: #e1e8e1; border-color: #3b4a3e; }
}
