:root {
  color-scheme: light;
  --page: #f8f9fc;
  --surface: #fff;
  --ink: #202330;
  --muted: #686f81;
  --line: #e6e8f0;
  --accent: #2b50e6;
  --accent-dark: #2141c9;
  --accent-soft: #eef1ff;
  --card-radius: 24px;
  --card-shadow: inset 0 0 0 1px #e5e8f1, 0 8px 24px #20233009;
  --font-text: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-math: "STIX Two Math", "Cambria Math", "Latin Modern Math", math, serif;
  font-family: var(--font-text);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
button:disabled { cursor: default; }
button { -webkit-appearance: none; appearance: none; }
[hidden] { display: none !important; }
.app-shell { max-width: 1104px; margin: 0 auto; padding: 0 48px; min-height: 100dvh; display: flex; flex-direction: column; }
.app-header { height: 108px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); flex: none; }
.wordmark { font-size: 32px; font-weight: 760; letter-spacing: -1.8px; color: var(--ink); text-decoration: none; padding: 8px 0; }
.wordmark span { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.install-trigger { border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--accent); min-height: 44px; padding: 9px 12px; font-size: 14px; font-weight: 600; }
.category-trigger { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 560; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; min-height: 44px; }
.grid-icon { width: 14px; height: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.grid-icon i { border: 1.3px solid currentColor; border-radius: 1px; }
.practice { width: min(100%, 480px); margin: 0 auto; padding-top: 38px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.practice-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 640; letter-spacing: 1.7px; line-height: 1.5; }
.exercise-counter { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.exercise-navigation { display: flex; align-items: center; gap: 2px; margin-right: -12px; }
.exercise-navigation .exercise-counter { min-width: 24px; text-align: center; }
.navigation-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--accent); font-size: 28px; font-weight: 400; line-height: 1; }
.navigation-button:disabled { color: #c9cedb; }
.navigation-button:not(:disabled):active { background: var(--accent-soft); }
.current-category { align-self: center; display: flex; align-items: center; gap: 10px; min-height: 44px; border: 0; padding: 7px 12px 7px 7px; border-radius: 12px; font-size: 14px; font-weight: 550; background: transparent; }
.category-symbol { display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); background: var(--accent-soft); border-radius: 9px; font-size: 22px; font-weight: 400; }
.chevron { display: inline-block; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -3px 3px 0 5px; }
.exercise-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: #d7dbea transparent; overscroll-behavior-y: contain; touch-action: pan-y pinch-zoom; -webkit-overflow-scrolling: touch; padding: 0 2px; outline: none; }
.question-card { background: var(--surface); border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.exercise { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 42px 0 48px; }
.exercise.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.question-block { text-align: center; flex: none; }
.exercise-level { margin: 0 0 26px; font-size: 14px; color: var(--muted); }
.operation { display: flex; align-items: center; justify-content: center; gap: .19em; margin: 0; font-size: calc(clamp(3.3rem, 7vw, 5.6rem) * var(--formula-scale, 1)); font-weight: 580; letter-spacing: -.045em; line-height: 1.18; font-variant-numeric: tabular-nums; white-space: nowrap; outline: none; }
.operator { font-weight: 350; color: #9ca3b7; }
.think-prompt { font-size: 15px; color: var(--muted); margin: 25px 0 0; }
.practice-footer { flex: none; padding-top: 18px; padding-bottom: 30px; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 60px; padding: 16px 22px; background: var(--accent); color: #fff; border: 0; border-radius: 16px; font-size: 16px; font-weight: 580; transition: background .15s ease, transform .15s ease; }
.primary-button:active { transform: scale(.982); background: var(--accent-dark); }
.button-symbol { font-size: 25px; line-height: 1; font-weight: 400; }
.action-hint { color: var(--muted); text-align: center; font-size: 13px; margin: 17px 0 0; min-height: 20px; line-height: 1.5; }
kbd { font: inherit; border: 1px solid #d9deec; background: var(--surface); border-radius: 5px; padding: 2px 6px; margin-right: 4px; font-size: 12px; }
.touch-hint { display: none; }
.page-footer { border-top: 1px solid var(--line); padding: 22px 0 25px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 580; letter-spacing: 1.5px; color: var(--muted); }
.result-wrap { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 13px 0 32px; }
.result { margin: 0; color: var(--accent); font-size: calc(58px * var(--formula-scale, 1)); line-height: 1.2; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-equals { color: #9ca3b7; font-size: calc(26px * var(--formula-scale, 1)); font-weight: 350; }
.recurring-number { white-space: nowrap; }
.recurring-period { text-decoration-line: overline; text-decoration-thickness: .055em; text-decoration-skip-ink: none; }
.steps-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 18px; }
.steps-count { font-size: 12px; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.step { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 12px 0; align-items: baseline; }
.step-number { color: #7a8295; font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.step-content { min-width: 0; }
.step-equation { display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 40%); gap: 8px; align-items: baseline; font-size: calc(18px * var(--formula-scale, 1)); font-weight: 450; line-height: 1.5; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.step-expression { min-width: 0; overflow-wrap: anywhere; }
.step-relation { color: #7a8295; font-weight: 400; text-align: center; }
.step-value { font-weight: 570; text-align: right; white-space: nowrap; }
.step-equation.is-flow { display: block; }
.step--main { padding-bottom: 20px; margin-bottom: 7px; }
.step--main .step-equation, .step--final .step-equation { font-size: calc(25px * var(--formula-scale, 1)); font-weight: 550; letter-spacing: -.035em; }
.step--final { margin-top: 12px; padding-top: 16px; }
.step--final .step-value { color: var(--accent); font-weight: 650; }
.step:last-child .step-value { color: var(--accent); }
.step-equation.is-long { font-size: calc(17px * var(--formula-scale, 1)); }
.memory-number { font-weight: 600; white-space: nowrap; }
.memory-color-0 { color: #bd343c; }
.memory-color-1 { color: #197147; }
.memory-color-2 { color: #815900; background: #fff0ac; border-radius: 3px; }
.memory-color-3 { color: #8551a7; }
.memory-color-4 { color: #087479; }
.memory-color-5 { color: #b04177; }
.exercise.is-revealed { justify-content: flex-start; padding: 24px 0 14px; }
.exercise.answer-only { justify-content: center; }
.is-revealed .exercise-level { margin-bottom: 13px; }
.is-revealed .operation { font-size: calc(36px * var(--formula-scale, 1)); letter-spacing: -.035em; }
.is-revealed .think-prompt { display: none; }
.is-revealed .solution { animation: solution-in .36s cubic-bezier(.2,.65,.3,1) both; }
.is-restored .solution { animation: none; }
.fraction { display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; vertical-align: middle; line-height: 1.2; }
.fraction > span:first-child { border-bottom: .025em solid currentColor; padding: 0 .17em .12em; }
.fraction > span:last-child { padding-top: .1em; }
.operation.is-large { font-size: calc(clamp(2rem, 6.4vw, 3.5rem) * var(--formula-scale, 1)); }
.is-revealed .operation.is-large { font-size: calc(28px * var(--formula-scale, 1)); }
.operation.is-percent { flex-wrap: wrap; }
.operation .of-label { color: var(--muted); font-size: .4em; letter-spacing: 0; font-weight: 400; }
.category-dialog, .install-dialog { border: 0; border-radius: 24px; width: min(calc(100% - 40px), 490px); max-height: min(820px, 90dvh); padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px #131d4526; overflow: hidden; }
.category-dialog[open], .install-dialog[open] { display: flex; flex-direction: column; animation: dialog-in .25s ease both; }
.category-dialog::backdrop, .install-dialog::backdrop { background: #171e394d; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.sheet-handle { display: none; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 30px 26px 22px; gap: 12px; }
.dialog-header h2 { font-size: 25px; font-weight: 620; letter-spacing: -.8px; margin: 8px 0 0; }
.close-button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--page); font-size: 27px; color: var(--muted); }
.dialog-scroll { padding: 0 26px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding-bottom: 6px; }
.category-option { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 7px; align-items: center; text-align: left; width: 100%; border: 1px solid transparent; border-radius: 12px; background: transparent; padding: 10px 6px; min-height: 58px; }
.category-option .option-symbol { font-size: 20px; display: grid; place-items: center; width: 30px; height: 34px; background: var(--page); border-radius: 9px; color: #60697c; }
.category-option .option-title { display: block; font-size: 14px; font-weight: 560; overflow-wrap: anywhere; }
.category-option .option-description { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.category-option[aria-pressed="true"] { background: var(--accent-soft); border-color: #dce3ff; }
.category-option[aria-pressed="true"] .option-symbol { color: var(--accent); background: #dfe6ff; }
.option-check { display: none; }
.category-option[aria-pressed="true"] .option-check { visibility: visible; }
.level-settings { padding: 0 0 5px; }
.setting-row { margin-bottom: 17px; }
.setting-label { display: block; font-size: 14px; margin-bottom: 10px; font-weight: 540; }
.setting-label small { font-size: 12px; font-weight: 400; color: var(--muted); }
.segmented { display: flex; padding: 4px; gap: 4px; background: var(--page); border: 1px solid var(--line); border-radius: 12px; }
.segment { flex: 1; border: 0; background: transparent; min-height: 40px; padding: 8px 4px; border-radius: 8px; font-size: 14px; }
.segmented.is-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented.is-grid .segment { min-height: 44px; }
.segment[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 5px #19264e10; font-weight: 620; }
.segmented.is-multiple .segment[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px #d0d9ff; }
.setting-note { margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-back { display: block; padding: 8px 0; margin: 0 0 16px; border: 0; background: transparent; color: var(--accent); min-height: 44px; font-size: 14px; }
.catalog-link { display: block; width: fit-content; margin: 5px auto -8px; padding: 12px; min-height: 44px; color: var(--muted); font-size: 13px; text-underline-offset: 3px; }
.exercise-catalog { padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)); }
.exercise-catalog .settings-back { margin-bottom: 4px; }
.catalog-note { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.catalog-category { border-bottom: 1px solid var(--line); }
.catalog-category-title { list-style: none; display: flex; align-items: center; gap: 11px; min-height: 66px; padding: 10px 2px; font-size: 16px; font-weight: 580; cursor: pointer; }
.catalog-category-title::-webkit-details-marker { display: none; }
.catalog-category-title::after { content: '+'; color: var(--muted); font-size: 23px; font-weight: 350; }
.catalog-category[open] > .catalog-category-title::after { content: '−'; }
.catalog-category-title .category-symbol { flex: none; font-size: 19px; }
.catalog-count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 450; font-variant-numeric: tabular-nums; }
.catalog-questions { list-style: none; padding: 0 0 16px; margin: 0; }
.catalog-question { display: block; width: 100%; text-align: left; border: 0; border-radius: 12px; background: transparent; padding: 14px 10px; min-height: 76px; }
.catalog-question:active { background: var(--accent-soft); }
.catalog-question-label { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; margin-bottom: 9px; }
.catalog-formula { color: var(--ink); font-size: 23px; line-height: 1.8; font-variant-numeric: tabular-nums; overflow-x: auto; overflow-y: hidden; padding: 2px 0 6px; }
.catalog-formula math { font-size: 1em; }
.catalog-formula math.long-expression { font-size: .78em; }
.types-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.types-header .setting-label { margin: 0; }
.select-all { border: 0; background: transparent; color: var(--accent); font-size: 14px; min-height: 44px; padding: 4px 0; text-align: right; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 4px; margin-bottom: 20px; }
.type-option { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 8px 3px; border: 0; background: transparent; text-align: left; font-size: 14px; line-height: 1.4; }
.type-check { display: grid; place-items: center; width: 19px; height: 19px; flex: none; border: 1px solid #bcc3d2; border-radius: 6px; color: transparent; font-size: 12px; }
.type-option[aria-pressed="true"] .type-check { background: var(--accent); border-color: var(--accent); color: white; }
.type-group-label { font-size: 14px; font-weight: 600; margin: 24px 0 9px; color: var(--muted); }
.primary-button:disabled { background: #e4e7ef; color: #737b90; transform: none; }
math { font-family: var(--font-math); font-weight: 400; letter-spacing: normal; }
math.long-expression { font-size: .84em; }
.formula-host { display: block; min-width: 0; }
.operation.is-symbolic { display: block; width: 100%; font-size: calc(clamp(28px, 8vw, 38px) * var(--formula-scale, 1)); padding-block: 8px; line-height: 1.8; letter-spacing: normal; }
.result.is-symbolic { font-size: calc(clamp(28px, 7vw, 38px) * var(--formula-scale, 1)); max-width: calc(100% - 38px); line-height: 1.8; letter-spacing: normal; text-align: center; }
.exercise-domain { color: var(--muted); margin: 10px 0 0; font-size: calc(16px * var(--formula-scale, 1)); }
.is-revealed .operation.is-symbolic { font-size: calc(29px * var(--formula-scale, 1)); }
.step-equation.is-symbolic { grid-template-columns: 18px minmax(0, 1fr); gap: 12px; font-size: calc(23px * var(--formula-scale, 1)); align-items: center; line-height: 1.85; letter-spacing: normal; }
.step--main .step-equation.is-symbolic, .step--final .step-equation.is-symbolic { font-size: calc(27px * var(--formula-scale, 1)); }
.step:last-child .step-equation.is-symbolic .formula-host { color: var(--accent); }
.step:has(.is-symbolic) { align-items: center; }
.dialog-footer { padding: 20px 26px 26px; }
.install-heading { display: flex; align-items: center; gap: 12px; padding: 26px 24px 20px; flex: none; }
.install-heading img { border-radius: 13px; flex: none; }
.install-heading h2 { font-size: 24px; font-weight: 620; letter-spacing: -.7px; margin: 5px 0 0; }
.install-heading .close-button { margin-left: auto; }
.install-body { padding: 0 26px 28px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.install-steps { display: grid; gap: 18px; margin: 0; padding-left: 24px; font-size: 16px; line-height: 1.55; }
.install-steps li { padding-left: 5px; }
.install-steps li::marker { color: var(--accent); font-weight: 650; }
.install-steps strong { font-weight: 600; }
.offline-readiness { font-size: 14px; line-height: 1.5; margin: 25px 0 7px; color: var(--muted); }
.offline-readiness.is-ready { color: #197147; }
.install-note { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
#native-install { margin-top: 22px; }
#offline-label { letter-spacing: .7px; }
.update-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 14px; line-height: 1.4; }
.update-notice button { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 12px; min-height: 44px; font-size: 14px; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.noscript { position: fixed; inset: 25%; background: white; padding: 24px; z-index: 10; }
@keyframes solution-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@media (hover: hover) { .primary-button:hover { background: var(--accent-dark); } .category-trigger:hover, .current-category:hover, .category-option:hover, .catalog-question:hover, .navigation-button:not(:disabled):hover { background: #eef0f7; } .category-option[aria-pressed="true"]:hover { background: var(--accent-soft); } .exercise-scroll { cursor: grab; } }
@media (min-width: 641px) { .app-shell { height: max(700px, 100dvh); max-height: 1100px; } }
@media (max-width: 640px) {
  .app-shell { height: 100dvh; min-height: 440px; padding: 0 24px; }
  .app-header { height: calc(82px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); }
  .wordmark { font-size: 30px; }
  .category-trigger { border: 0; background: transparent; padding-right: 0; }
  .practice { padding-top: 24px; }
  .practice-topline { margin-bottom: 16px; }
  .exercise { padding-top: 30px; padding-bottom: 36px; }
  .operation { font-size: calc(clamp(3rem, 17vw, 4.5rem) * var(--formula-scale, 1)); }
  .exercise-level { margin-bottom: 23px; }
  .practice-footer { padding-top: 15px; padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)); }
  .primary-button { min-height: 58px; }
  .action-hint { font-size: 13px; margin-top: 15px; }
  .touch-hint { display: inline; }
  .keyboard-hint, .page-footer { display: none; }
  .is-revealed .operation { font-size: calc(31px * var(--formula-scale, 1)); }
  .exercise.is-revealed { padding: 12px 0 10px; }
  .result { font-size: calc(53px * var(--formula-scale, 1)); }
  .result-wrap { padding: 8px 0 20px; }
  .step { padding: 8px 0; gap: 9px; grid-template-columns: 18px minmax(0, 1fr); }
  .step-equation { font-size: calc(17px * var(--formula-scale, 1)); }
  .step--main { padding-bottom: 14px; margin-bottom: 4px; }
  .step--final { padding-top: 12px; }
  .step--main .step-equation, .step--final .step-equation { font-size: calc(clamp(20px, 5.65vw, 24px) * var(--formula-scale, 1)); }
  .step-equation.is-long { font-size: calc(16px * var(--formula-scale, 1)); }
  .category-dialog, .install-dialog { position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: 93dvh; margin: 0; border-radius: 24px 24px 0 0; }
  .sheet-handle { display: block; height: 4px; width: 34px; border-radius: 5px; background: #d8dce7; flex: none; margin: 10px auto 0; }
  .dialog-header { padding: 22px 24px 18px; }
  .dialog-scroll { padding: 0 18px; }
  .dialog-footer { padding: 18px 24px max(24px, env(safe-area-inset-bottom, 24px)); }
  .install-heading { padding-top: 20px; }
  .install-body { padding-bottom: max(28px, env(safe-area-inset-bottom, 28px)); }
  .level-settings { margin-left: 6px; margin-right: 6px; }
  .step-equation.is-symbolic { font-size: calc(22px * var(--formula-scale, 1)); gap: 8px; }
  .step--main .step-equation.is-symbolic, .step--final .step-equation.is-symbolic { font-size: calc(25px * var(--formula-scale, 1)); }
  .operation.is-large { font-size: calc(clamp(1.8rem, 7.7vw, 2.8rem) * var(--formula-scale, 1)); }
  .is-revealed .operation.is-large { font-size: calc(25px * var(--formula-scale, 1)); }
}
@media (max-width: 350px) {
  .app-shell { padding-inline: 18px; }
  .category-option { grid-template-columns: 22px minmax(0, 1fr); gap: 5px; padding-inline: 0; }
  .category-option .option-symbol { width: 22px; font-size: 17px; }
  .category-option .option-title { font-size: 14px; overflow-wrap: normal; }
  .type-grid { column-gap: 8px; }
  .type-option { gap: 7px; }
  .header-actions { gap: 8px; }
  .install-trigger { padding-inline: 9px; }
  .category-trigger { gap: 7px; }
  .install-heading { padding-inline: 20px; gap: 10px; }
  .install-heading h2 { font-size: 22px; }
  .install-heading .eyebrow { font-size: 11px; }
}
@media (max-height: 690px) and (max-width: 640px) {
  .app-header { height: calc(66px + env(safe-area-inset-top, 0px)); }
  .practice { padding-top: 15px; }
  .practice-topline { margin-bottom: 8px; }
  .exercise { padding-top: 20px; }
  .practice-footer { padding-bottom: max(15px, env(safe-area-inset-bottom, 15px)); }
  .result-wrap { padding-bottom: 20px; }
  .result { font-size: calc(46px * var(--formula-scale, 1)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
