@import url("variables.css");

#def-popup {
  position: fixed;
  bottom: -60vh;
  left: 0;
  right: 0;
  height: 55vh;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  box-shadow: 0 -5px 20px var(--shadow-elevated);
  transition: bottom 0.25s cubic-bezier(0.1, 0.7, 0.1, 1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  font-family: system-ui, sans-serif;
}
#def-popup.visible {
  bottom: 0;
}

.popup-header {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
}
.popup-title {
  font-weight: bold;
  color: var(--text-muted);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.close-btn {
  background: none;
  border: none;
  font-size: 1.8em;
  padding: 0 10px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.popup-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0;
}

.dictionary-message {
  padding: 30px;
  color: var(--text-muted);
  text-align: center;
}

.dictionary-navigation {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 15px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.dictionary-back {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent-interactive);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.result-item {
  padding: 15px;
  border-bottom: 1px solid var(--border);
}
.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.word-main {
  font-size: 1.6em;
  font-weight: bold;
  color: var(--text-body);
}

.freq-badge {
  font-size: 0.8em;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-family: system-ui, sans-serif;
  font-weight: 500;
}

.anki-btn {
  background: var(--accent-add);
  color: var(--bg-base);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.anki-btn-suspended {
  background: #faf2bd;
  color: #6b621f;
}

@media (prefers-color-scheme: dark) {
  .anki-btn-suspended {
    background: #eee5a5;
    color: #554d18;
  }
}

.anki-btn:active {
  transform: scale(0.95);
}

.anki-btn:disabled {
  background-color: var(--border);
}

.entry-block {
  margin-top: 8px;
}
.entry-pinyin {
  font-weight: bold;
  color: var(--accent-primary);
  font-family: "Georgia", serif;
  font-size: 1.05em;
}
.entry-defs {
  margin: 4px 0 0 0;
  padding-left: 20px;
  color: var(--text-body);
  font-size: 1em;
  line-height: 1.4;
}
.entry-defs li {
  margin-bottom: 4px;
}

.dictionary-reference {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-interactive);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.dictionary-reference:hover {
  color: var(--accent-interactive-hover);
}

.dictionary-reference:focus-visible,
.dictionary-back:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.reference-preview {
  margin: 8px 0 8px -8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent-interactive);
  border-radius: 0 4px 4px 0;
  background: var(--bg-subtle);
}

.reference-preview-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.reference-preview-word {
  color: var(--text-body);
  font-size: 1.1em;
  font-weight: 700;
}

.reference-preview-pinyin {
  margin-top: 2px;
  color: var(--accent-primary);
  font-family: "Georgia", serif;
  font-weight: 600;
}

.reference-preview-defs {
  margin: 4px 0 0;
  padding-left: 20px;
  color: var(--text-body);
}

.llm-badge {
  background: #6c5ce7 !important; /* distinct purple so it's not mistaken for a freq rank */
  color: #fff !important;
}

.lookup-highlight {
  background-color: var(--accent-highlight);
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--accent-highlight);
}
