/* ── Vocabulary Side Panel ─────────────────────────────────────────────── */

.vocab-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-sub);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-behavior: smooth;
  /* Edge fade like lyrics panel */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 8%,
    black 88%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 8%,
    black 88%,
    transparent 100%
  );
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Keyword Card ──────────────────────────────────────────────────────── */
.keyword-card {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.3s;
  cursor: pointer;
}

.keyword-card:last-child { border-bottom: none; }

.keyword-card:hover {
  background: rgba(255,255,255,0.03);
}

.kw-word {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kw-def {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── CEFR Badge ────────────────────────────────────────────────────────── */
.cefr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  color: #000;
}

.cefr-badge.a1 { background: var(--a1); }
.cefr-badge.a2 { background: var(--a2); }
.cefr-badge.b1 { background: var(--b1); }
.cefr-badge.b2 { background: var(--b2); }
.cefr-badge.c1 { background: var(--c1); }
.cefr-badge.c2 { background: var(--c2); }

/* ── Placeholder cards shimmer ─────────────────────────────────────────── */
.placeholder-card {
  opacity: 0.55;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.panel-empty {
  padding: 24px 18px;
  font-size: 0.8rem;
  color: var(--text-sub);
  text-align: center;
}

/* ── Animation: new card fades in + slides up ────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.keyword-card.new {
  animation: card-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Brief highlight glow on new card */
.keyword-card.highlight {
  background: rgba(78, 205, 196, 0.08);
  transition: background 1.2s ease-out;
}

.keyword-card.highlight-out {
  background: transparent;
}

/* ── Favorited card ──────────────────────────────────────────────────── */
.keyword-card.favorited {
  background: rgba(78, 205, 196, 0.08);
  border-left-color: var(--accent);
  border-left-width: 3px;
}

.keyword-card.favorited .kw-word::after {
  content: "★";
  font-size: 0.65rem;
  color: var(--accent);
  margin-left: auto;
}

.keyword-card.favorited:hover {
  background: rgba(78, 205, 196, 0.13);
}

/* ── Active segment highlight ─────────────────────────────────────────── */
.keyword-card.segment-active {
  border-left-color: var(--accent);
  background: rgba(78, 205, 196, 0.05);
}

.keyword-card.segment-active:hover {
  background: rgba(78, 205, 196, 0.09);
}

/* ── Scroll-to-bottom button ──────────────────────────────────────────── */
.vocab-scroll-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, background 0.15s;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.vocab-scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.vocab-scroll-btn:hover {
  background: var(--accent);
  color: #000;
}

/* Panel needs relative positioning for the button */
.vocab-panel {
  position: relative;
}

/* ── Mobile: panel is a bottom sheet ──────────────────────────────────── */
@media (max-width: 768px) {
  .vocab-panel {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .panel-header {
    padding: 8px 16px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
  }

  /* Drag handle indicator */
  .panel-header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
  }

  .panel-title { font-size: 0.72rem; }
  .panel-subtitle { font-size: 0.65rem; }

  .keyword-card { padding: 8px 14px; }
  .kw-word { font-size: 0.82rem; gap: 6px; }
  .kw-def { font-size: 0.72rem; }
  .cefr-badge { font-size: 0.58rem; padding: 1px 4px; }
}
