.doc-save-btn {
  position: relative;
  margin-right: 4px;
  margin-left: -8px !important;
  padding: 8px !important;
  color: var(--color-text-faint) !important;
}
.doc-save-btn svg {
  width: 14px !important;
  height: 14px !important;
}
.doc-save-btn:hover {
  color: var(--color-text-primary) !important;
}
.doc-save-btn::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.grammar-page.editor-empty .top-controls {
  pointer-events: auto !important;
  opacity: 1 !important;
}
.grammar-page.editor-empty .top-controls .left-controls {
  pointer-events: auto !important;
  opacity: 1 !important;
}
.mic-guide-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  background: var(--color-card, #fff);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-family: var(--font-family);
  animation: micGuideSlideIn 0.3s ease;
  transition: opacity 0.2s ease;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 500px;
  width: calc(100% - 32px);
}
@keyframes micGuideSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.mic-guide-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  color: var(--color-text-secondary);
}
.mic-guide-text {
  flex: 1;
  min-width: 0;
}
.mic-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 3px;
}
.mic-guide-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}
.mic-guide-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.mic-guide-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .mic-guide-banner,
.dark-mode .mic-guide-banner {
  background: var(--color-card, #2b2a27);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(20, 18, 15, 0.3);
}
.scratch-restore-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  background: #FFFEFB;
  color: #3A2F26;
  border: 1px solid rgba(58, 47, 38, 0.08);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(58, 47, 38, 0.04), 0 8px 24px rgba(58, 47, 38, 0.10);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.scratch-restore-toast::before {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background: #6E8A7E;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(110, 138, 126, 0.12);
}
.scratch-restore-toast > span {
  color: #3A2F26;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: 0;
}
.scratch-restore-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.scratch-restore-undo {
  background: transparent;
  color: #4A7A68;
  border: 1px solid rgba(110, 138, 126, 0.28);
  border-radius: 10px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.scratch-restore-undo:hover {
  color: #A6594B;
  background: rgba(166, 89, 75, 0.06);
  border-color: rgba(166, 89, 75, 0.32);
}
.scratch-restore-undo:focus-visible {
  outline: 2px solid rgba(110, 138, 126, 0.45);
  outline-offset: 2px;
}
.scratch-restore-undo:active {
  transform: translateY(1px);
}
.doc-save-btn.is-saving {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}
.doc-save-btn.is-saving svg {
  animation: docSaveSpin 0.8s linear infinite;
}
@keyframes docSaveSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
[data-theme="dark"] .doc-save-btn {
  color: var(--color-text-tertiary, #94918b) !important;
}
[data-theme="dark"] .doc-save-btn:hover {
  color: #8FBAAA !important;
}
@media (max-width: 767px) {
  .doc-save-btn {
    min-height: 36px;
    min-width: 36px;
    padding: 6px;
  }
  .scratch-restore-toast {
    bottom: 18px;
    max-width: calc(100% - 28px);
    padding: 11px 12px 11px 16px;
    gap: 12px;
    font-size: 13.5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .doc-save-btn.is-saving svg {
    animation: none;
  }
  .scratch-restore-toast {
    transition: opacity 0.25s ease;
    transform: translateX(-50%);
  }
  .scratch-restore-toast.visible {
    transform: translateX(-50%);
  }
  .scratch-restore-undo {
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  }
  .scratch-restore-undo:active {
    transform: none;
  }
}
