/* 讲义例句 · 点击查词（grammar-handout-lookup.js） */
.lookup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
}
.lookup-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.lookup-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(420px, 96vw);
  background: #fff;
  border-left: 1px solid #e5e7eb;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 210;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
}
.lookup-panel.open {
  transform: translateX(0);
}
.lookup-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  color: #fff;
}
.lookup-panel header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.lookup-close {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.lookup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.65;
  color: #1a1a1a;
}
.lookup-head {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: #0f766e;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lookup-tts-btn {
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.2;
  vertical-align: middle;
  flex-shrink: 0;
}
.lookup-tts-btn:hover {
  background: #ccfbf1;
}
.lookup-tts-btn:disabled,
.lookup-tts-btn.is-playing {
  opacity: 0.55;
  cursor: wait;
}
.lookup-tts-btn--word {
  padding: 5px 12px;
  font-size: 0.88rem;
}
.lookup-tts-btn--inline {
  padding: 2px 7px;
  margin-left: 4px;
  font-size: 0.78rem;
  border-radius: 5px;
}
.lookup-phonetic {
  font-weight: 400;
  color: #64748b;
  font-size: 0.92rem;
}
.lookup-ex-en {
  margin: 4px 0 2px;
  padding: 6px 8px;
  background: #f0fdfa;
  border-radius: 4px;
  font-style: italic;
  color: #0f766e;
  font-size: 0.92rem;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}
.lookup-ex-en--context {
  margin-top: 8px;
}
.lookup-ex-en-label {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0d9488;
  background: #ccfbf1;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.lookup-ex-en-text {
  flex: 1;
  min-width: 0;
}
.lookup-section-title {
  margin: 12px 0 6px;
  color: #0d9488;
  font-size: 0.9rem;
  font-weight: 600;
}
.lookup-usage-list {
  margin: 0;
  padding-left: 1.2em;
}
.lookup-usage-item {
  margin-bottom: 10px;
}
.lookup-ex-zh {
  margin: 0;
  color: #5c5c5c;
  font-size: 0.88rem;
}
.lookup-muted {
  color: #9ca3af;
}
.lookup-bad {
  color: #dc2626;
}
.lookup-raw {
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.gh-word {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 0.12s ease;
}
.gh-word:hover,
.gh-word.active {
  background: rgba(20, 184, 166, 0.18);
  box-shadow: inset 0 -2px 0 rgba(13, 148, 136, 0.35);
}

body.grammar-handout-page .handout-lookup-hint {
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  color: #0f766e;
  background: rgba(240, 253, 250, 0.9);
  border: 1px dashed rgba(13, 148, 136, 0.35);
  border-radius: 8px;
}

.gh-lookup-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 220;
}
.gh-lookup-toast.show {
  opacity: 1;
}

@media print {
  .lookup-backdrop,
  .lookup-panel,
  .gh-lookup-toast,
  .handout-lookup-hint {
    display: none !important;
  }
  body.grammar-handout-page .gh-word {
    background: none !important;
    box-shadow: none !important;
  }
}
