/* =========================================================
   矩阵计算器 —— 样式（深 / 浅双主题）
   ========================================================= */
:root {
  --bg: #0b0e14;
  --bg-soft: #0f141d;
  --panel: #11151f;
  --cell: #1b2231;
  --cell-line: #232b3d;
  --text: #e6eaf2;
  --muted: #8b93a6;
  --accent: #4f8cff;
  --accent-soft: #1b2a4a;
  --ok: #7ef0b0;
  --ok-soft: #12302a;
  --danger: #ff7b7b;
  --danger-soft: #3a1d22;
  --shadow: 0 14px 34px rgba(0, 0, 0, .45);
  --radius: 12px;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --panel: #ffffff;
  --cell: #eef2f9;
  --cell-line: #d6dfec;
  --text: #18202f;
  --muted: #66718a;
  --accent: #2f6bd6;
  --accent-soft: #e3edff;
  --ok: #1d8f5f;
  --ok-soft: #e3f7ec;
  --danger: #c93b3b;
  --danger-soft: #fdeaea;
  --shadow: 0 10px 26px rgba(30, 50, 90, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 40px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

button, select, input { font-family: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--cell-line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.brand .logo { color: var(--accent); }
.brand .ver { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.tools { display: flex; align-items: center; gap: 10px; }
#updateBtn {
  background: var(--accent); border-color: var(--accent); color: #fff;
  border-radius: 999px; font-size: 12.5px; padding: 5px 12px;
}
#updateBtn[hidden] { display: none; }
#updateBtn:disabled { opacity: .85; cursor: default; }
.tool { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.icon-btn {
  background: transparent; border: 1px solid var(--cell-line); color: var(--text);
  border-radius: 9px; padding: 5px 9px; font-size: 15px; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); }

/* ---------- 通用 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 22px 0; display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--cell-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint {
  margin: 0; padding: 10px 14px;
  background: var(--panel); border: 1px dashed var(--cell-line); border-radius: 10px;
  font-size: 12.5px; color: var(--muted); line-height: 1.9;
}
.hint code {
  background: var(--cell); color: var(--text);
  padding: 1px 6px; border-radius: 5px; font-size: 12px;
  font-family: Consolas, "Cascadia Mono", monospace;
}
.hint b { color: var(--text); font-weight: 600; }
select {
  background: var(--cell); color: var(--text); border: 1px solid var(--cell-line);
  border-radius: 7px; padding: 4px 7px; font-size: 13px;
}
select:hover { border-color: var(--accent); }

.btn {
  background: var(--cell); color: var(--text);
  border: 1px solid var(--cell-line); border-radius: 8px;
  padding: 6px 11px; font-size: 13px;
  transition: border-color .15s, background .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.mini { padding: 4px 9px; font-size: 14px; line-height: 1.1; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- 矩阵槽 ---------- */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slot {
  background: var(--panel);
  border: 1px solid var(--cell-line);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.slot-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.slot-title { font-size: 17px; color: var(--accent); min-width: 18px; }
.dims { display: flex; gap: 8px; }
.dims label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.slot-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.grid-wrap { overflow: auto; padding: 2px 0 6px; }
.grid { display: inline-grid; gap: 6px; }
.cell-input {
  width: 66px; height: 44px; text-align: center;
  background: var(--cell); color: var(--text);
  border: 1px solid transparent; border-radius: 7px;
  font-size: 15px; font-variant-numeric: tabular-nums;
  outline: none; transition: border-color .15s, background .15s;
}
.cell-input:focus { border-color: var(--accent); background: var(--accent-soft); }
.cell-input.invalid { border-color: var(--danger); background: var(--danger-soft); }
.slot-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.badge {
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 1px 8px; font-size: 11.5px;
}

/* ---------- 运算区 ---------- */
.op-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.op-label { color: var(--muted); }
.radio { display: flex; align-items: center; gap: 5px; color: var(--text); font-size: 13px; }
.dim-hint { margin-left: auto; font-size: 12px; }
.dim-hint.bad { color: var(--danger); }
.dim-hint.good { color: var(--ok); }
.op-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.divider { width: 1px; background: var(--cell-line); margin: 0 4px; }
.op-btn {
  background: var(--cell); color: var(--text);
  border: 1px solid var(--cell-line); border-radius: 9px;
  padding: 8px 13px; font-size: 13.5px;
  transition: border-color .15s, background .15s, transform .08s;
}
.op-btn:hover { border-color: var(--accent); }
.op-btn:active { transform: translateY(1px); }
.op-btn.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- 结果 ---------- */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.result-label { font-size: 14px; color: var(--muted); }
.result-actions { display: flex; gap: 6px; }
.result-body { min-height: 96px; display: flex; align-items: center; justify-content: center; }
.placeholder { color: var(--muted); font-size: 13px; }
.result-matrix { display: inline-grid; gap: 6px; }
.result-cell {
  min-width: 66px; height: 44px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid var(--ok); border-radius: 7px;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.result-scalar {
  font-size: 30px; color: var(--ok); font-variant-numeric: tabular-nums;
  padding: 8px 16px;
}
.error {
  margin-top: 10px; padding: 9px 12px;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger); border-radius: 8px;
  font-size: 13px; line-height: 1.7;
}

/* ---------- 历史 ---------- */
.history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.history-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.history-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.history-item {
  flex: 0 0 auto; min-width: 148px;
  background: var(--bg-soft); border: 1px solid var(--cell-line);
  border-radius: 10px; padding: 8px 10px;
}
.history-item .h-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.history-item .h-name b { color: var(--accent); font-weight: 600; }
.history-item .h-size { font-size: 11.5px; color: var(--muted); }
.history-mini { display: inline-grid; gap: 3px; margin: 6px 0; }
.history-mini span {
  min-width: 30px; height: 20px; display: flex; align-items: center; justify-content: center;
  background: var(--cell); border-radius: 4px; font-size: 10.5px; color: var(--muted);
  padding: 0 4px;
}
.history-acts { display: flex; gap: 4px; }
.history-acts button { padding: 2px 7px; font-size: 11.5px; border-radius: 6px; }
.h-del { color: var(--danger); border-color: transparent; background: transparent; }

/* ---------- 菜单 / 提示 ---------- */
.menu {
  position: absolute; z-index: 60;
  background: var(--panel); border: 1px solid var(--cell-line);
  border-radius: 10px; padding: 6px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; min-width: 150px;
}
.menu[hidden] { display: none; }
.menu button {
  text-align: left; background: transparent; color: var(--text);
  border: none; border-radius: 7px; padding: 7px 10px; font-size: 13px;
}
.menu button:hover { background: var(--accent-soft); color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  padding: 9px 18px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .3); z-index: 80;
}
.toast[hidden] { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .slots { grid-template-columns: 1fr; }
  .cell-input { width: 54px; height: 40px; font-size: 14px; }
  .slot-actions { margin-left: 0; width: 100%; }
  .wrap { padding: 14px 12px 0; }
  .topbar { padding: 12px 14px; }
  .dim-hint { margin-left: 0; width: 100%; }
}

/* =========================================================
   运算动画
   ========================================================= */
.anim-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 8, 14, .72);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.anim-overlay[hidden] { display: none; }

.anim-panel {
  width: min(1060px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--panel);
  border: 1px solid var(--cell-line);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; overflow: hidden;
}
.anim-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--cell-line);
  font-size: 14px; font-weight: 600;
}
.anim-head-actions { display: flex; align-items: center; gap: 8px; }
.anim-head-actions .btn { font-size: 12.5px; padding: 5px 10px; font-weight: 400; }
.anim-stage { flex: 1; overflow: auto; padding: 18px; min-height: 420px; }
.anim-controls {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 18px; border-top: 1px solid var(--cell-line);
  background: var(--bg-soft);
}
.anim-controls .btn { font-size: 12.5px; padding: 5px 9px; }
.anim-controls input[type="number"] {
  width: 72px; text-align: center;
  background: var(--cell); color: var(--text);
  border: 1px solid var(--cell-line); border-radius: 7px; padding: 4px 6px; font-size: 12.5px;
}
.anim-status { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---- 浮层里的矩阵 ---- */
.anim-matrix {
  display: inline-grid; gap: 6px; padding: 10px 12px;
  border-radius: 12px; background: var(--bg-soft);
  border: 1px solid var(--cell-line);
}
.anim-cell {
  width: 56px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cell); border: 1px solid transparent; border-radius: 6px;
  font-size: 15px; font-variant-numeric: tabular-nums;
  transition: background .2s, border-color .2s, color .2s, transform .2s, opacity .2s;
}
.anim-cell.blank { background: transparent; border: 1px dashed var(--cell-line); color: transparent; }
.anim-cell.hl { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.anim-cell.filled { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.anim-cell.pop { transform: scale(1.1); }

/* ---- 表达式 ---- */
.anim-expr {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; min-height: 100px; flex-wrap: nowrap;
}
.anim-expr .tk {
  width: 62px; height: 42px; flex: 0 0 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--accent-soft); color: var(--accent);
  font-size: 18px; font-variant-numeric: tabular-nums;
  visibility: hidden; opacity: 0; transform: translateY(4px);
  transition: opacity .18s, transform .18s;
}
.anim-expr .tk.show { visibility: visible; opacity: 1; transform: none; }
.anim-expr .tk.op {
  width: 24px; flex: 0 0 24px; background: none; color: var(--muted); font-size: 17px;
}
.anim-expr .tk.result { background: var(--ok-soft); color: var(--ok); }
.anim-expr:empty::before {
  content: "点「播放」开始";
  color: var(--muted); font-size: 13px;
}

/* ---- 乘法布局 ---- */
.anim-mul {
  display: grid; gap: 14px; min-height: 440px;
  grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr;
  transition: .4s;
}
.anim-mul .anim-expr { grid-column: 1 / -1; grid-row: 1; }
.anim-mul .anim-operands {
  grid-column: 1; grid-row: 2;
  display: flex; align-items: flex-end; justify-content: flex-start; gap: 12px;
  transition: opacity .5s, transform .5s;
}
.anim-mul .anim-result {
  grid-column: 2; grid-row: 2;
  display: flex; align-items: flex-end; justify-content: center;
  transition: transform .8s cubic-bezier(.2, .8, .2, 1), opacity .4s;
}
.anim-mul.done .anim-expr,
.anim-mul.done .anim-operands { opacity: 0; pointer-events: none; }
.anim-op-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.anim-op-label { font-size: 11.5px; color: var(--muted); }
.anim-op-times { font-size: 20px; color: var(--muted); padding-bottom: 26px; }

/* ---- 幻影 ---- */
.anim-ghost {
  position: fixed; z-index: 95; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 15px; font-variant-numeric: tabular-nums;
  background: var(--accent); color: #fff; opacity: .9;
  box-shadow: 0 12px 30px rgba(79, 140, 255, .45);
}

/* ---- 通用卡片与箭头 ---- */
.anim-stage { position: relative; }
.anim-hint-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 5; max-width: 470px;
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: 10px;
}
.anim-hint-title { font-size: 14px; font-weight: 600; color: var(--text); }
.anim-hint-text { font-size: 12.5px; color: var(--muted); line-height: 1.85; }
.anim-hint-text b { color: var(--accent); font-weight: 600; }
.anim-hint-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.anim-hint-actions .btn { font-size: 12.5px; padding: 6px 12px; }

/* 引导里的循环对比演示 */
.anim-hint-demo { display: flex; gap: 16px; margin: 2px 0 4px; }
.anim-hint-demo .demo-item {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  font-size: 11.5px; color: var(--muted);
}
.demo-track { display: flex; gap: 4px; }
.demo-track i {
  flex: 1; height: 16px; border-radius: 4px;
  background: var(--cell); border: 1px solid var(--cell-line);
}
.demo-track.auto i { animation: demoAuto 3.2s ease-in-out infinite; }
.demo-track.auto i:nth-child(2) { animation-delay: .35s; }
.demo-track.auto i:nth-child(3) { animation-delay: .7s; }
@keyframes demoAuto {
  0%, 12% { background: var(--cell); border-color: var(--cell-line); }
  25%, 62% { background: var(--accent-soft); border-color: var(--accent); }
  85%, 100% { background: var(--cell); border-color: var(--cell-line); }
}
.demo-track.step i { animation: demoStep 3.2s steps(1, end) infinite; }
.demo-track.step i:nth-child(2) { animation-delay: .8s; }
.demo-track.step i:nth-child(3) { animation-delay: 1.6s; }
@keyframes demoStep {
  0% { background: var(--cell); border-color: var(--cell-line); }
  25% { background: var(--accent-soft); border-color: var(--accent); }
}
.anim-card-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.anim-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.anim-arrow { font-size: 24px; color: var(--muted); }
.anim-op-times { font-size: 20px; color: var(--muted); padding: 0 4px; }
.anim-trans-row {
  display: flex; align-items: center; justify-content: center;
  gap: 34px; flex-wrap: wrap; min-height: 300px;
}

/* ---- 翻纸 ---- */
.anim-flip-scene {
  perspective: 1500px; display: grid; place-items: center; min-height: 380px;
}
.anim-paper {
  transform-style: preserve-3d; will-change: transform;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45));
}
.anim-paper-inner { transform-style: preserve-3d; will-change: transform; }

/* ---- 秩 ---- */
.anim-rank {
  position: relative; display: flex; justify-content: center;
  padding: 18px 0 18px 130px; min-height: 380px;
}
.anim-rank-arrows {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.anim-rank-arrow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.anim-rank-label { font-size: 12.5px; fill: var(--muted); }
.anim-cell.hl2 { background: var(--bg-soft); border-color: var(--muted); color: var(--muted); }
.anim-cell.src { opacity: .35; }

/* ---- 行列式 ---- */
.anim-det { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.anim-det-left { display: flex; flex-direction: column; gap: 14px; }
.anim-det-expr {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  min-height: 48px; font-size: 16px;
}
.anim-det-term {
  padding: 4px 7px; background: var(--accent-soft); color: var(--accent);
  border-radius: 6px; font-variant-numeric: tabular-nums;
}
.anim-det-op { color: var(--muted); }
.anim-det-result {
  padding: 4px 12px; background: var(--ok-soft); color: var(--ok);
  border-radius: 6px; font-size: 18px;
}
.anim-det-result.big { font-size: 26px; margin-top: 12px; }
.anim-minors {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 8px; justify-content: flex-start;
  scroll-behavior: smooth;
}
.anim-minor { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }

/* ---- 求逆 ---- */
.anim-inv { display: flex; flex-direction: column; gap: 10px; }
.anim-inv-flow {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: center;
}
.anim-inv-card { animation: animCardIn .3s both; }
@keyframes animCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.anim-flow-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 110px; transition: opacity .3s;
}
.anim-flow-arrow.hidden { opacity: 0; }
.anim-flow-text { font-size: 12px; color: var(--muted); text-align: center; }
.anim-flow-line {
  width: 100%; height: 1px; position: relative;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.anim-verify-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 16px; }
.anim-verify-btn {
  background: var(--ok-soft); border-color: var(--ok); color: var(--ok);
  padding: 8px 16px; border-radius: 9px; font-size: 13px;
}
.anim-verify-stage {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; justify-content: center; padding-top: 12px;
}

/* =========================================================
   反馈弹窗
   ========================================================= */
.fb-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 14, .62); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.fb-overlay[hidden] { display: none; }
.fb-panel {
  width: min(520px, 100%);
  background: var(--panel); border: 1px solid var(--cell-line);
  border-radius: 14px; box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; overflow: hidden;
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--cell-line); font-size: 14px;
}
.fb-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow: auto; }
.fb-row { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.fb-row em { color: var(--danger); font-style: normal; }
.fb-row textarea, .fb-row input[type="text"] {
  background: var(--cell); color: var(--text);
  border: 1px solid var(--cell-line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; outline: none; resize: vertical;
}
.fb-row textarea:focus, .fb-row input[type="text"]:focus { border-color: var(--accent); }
.fb-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.fb-note { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.fb-msg { font-size: 12.5px; line-height: 1.6; min-height: 18px; }
.fb-msg.ok { color: var(--ok); }
.fb-msg.bad { color: var(--danger); }
.fb-msg.warn { color: #ffb84d; }
.fb-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--cell-line); background: var(--bg-soft);
}
.fb-foot .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 云同步面板 */
.sync-status {
  font-size: 13px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 8px; padding: 8px 10px;
}
.sync-row { display: flex; gap: 8px; align-items: center; }
.sync-row input {
  flex: 1; background: var(--cell); color: var(--text);
  border: 1px solid var(--cell-line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; letter-spacing: 2px;
  text-transform: uppercase; outline: none;
}
.sync-row input:focus { border-color: var(--accent); }
.fb-note code { background: var(--cell); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

@media (max-width: 760px) {
  .anim-overlay { padding: 8px; }
  .anim-mul { grid-template-columns: 1fr; grid-template-rows: auto auto auto; min-height: 0; }
  .anim-mul .anim-operands { grid-column: 1; grid-row: 2; justify-content: center; }
  .anim-mul .anim-result { grid-column: 1; grid-row: 3; }
  .anim-cell { width: 44px; height: 36px; font-size: 13px; }
  .anim-expr .tk { width: 50px; flex: 0 0 50px; height: 36px; font-size: 15px; }
}
