/* ---------- 数学符号键盘 ---------- */
.mathkey-field { display: flex; gap: 8px; align-items: flex-start; }
.mathkey-field > .mathkey-input { flex: 1; min-width: 0; }
.mathkey-toggle {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 8px;
  border: 1px solid #d1e7dd; background: #f0fdf7; color: #059669;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
  font-family: Georgia, serif;
}
.mathkey-toggle:hover { background: #d1fae5; border-color: #10b981; }
.mathkey-toggle:active { transform: translateY(1px); }

.mathkey-panel {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(660px, calc(100vw - 24px)); z-index: 9999;
  background: rgba(255, 255, 255, .97); border: 1px solid #e2e8f0;
  border-radius: 16px; box-shadow: 0 14px 44px rgba(15, 23, 42, .16);
  padding: 10px 12px 12px; display: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.mathkey-panel.open { display: block; }

.mathkey-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.mathkey-title {
  font-size: 12.5px; font-weight: 700; color: #059669;
  letter-spacing: .5px;
}
.mathkey-close {
  border: 1px solid #e2e8f0; background: #fff; color: #64748b;
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.mathkey-close:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }

.mathkey-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px;
}
.mathkey-tab {
  padding: 3px 11px; border-radius: 999px; font-size: 12px;
  background: #f1f5f9; color: #475569; cursor: pointer;
  border: 1px solid transparent; transition: .15s;
}
.mathkey-tab:hover { background: #e2e8f0; }
.mathkey-tab.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; box-shadow: 0 2px 8px rgba(16, 185, 129, .3);
}

.mathkey-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px; max-height: 148px; overflow-y: auto;
  padding-right: 2px;
}
.mathkey-btn {
  padding: 6px 4px; border-radius: 8px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 15px; cursor: pointer; color: #1e293b;
  transition: .14s; line-height: 1.3; min-height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mathkey-btn:hover { border-color: #10b981; background: #ecfdf5; transform: translateY(-1px); }
.mathkey-btn:active { transform: translateY(0); }
.mathkey-btn .katex { font-size: 1.06em; }

.mathkey-preview {
  margin-top: 8px; min-height: 36px; padding: 7px 12px; border-radius: 10px;
  background: #f8fafc; border: 1px dashed #dbe3ec; font-size: 16px;
  color: #334155; display: flex; align-items: center;
  overflow-x: auto; white-space: nowrap;
}
.mathkey-preview .mk-ph { color: #94a3b8; font-size: 12.5px; }
