.vocab-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.vocab-cards {
  flex: 1;
  min-height: 0;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  align-content: start;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .vocab-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 520px) {
  .vocab-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Pulsating green line on the bottom edge */
@keyframes pulse-line {
  0%, 100% { opacity: 0.45; box-shadow: 0 0 6px #4caf50, 0 -2px 10px #4caf5040; }
  50%       { opacity: 1;    box-shadow: 0 0 18px #4caf50, 0 -4px 28px #4caf5070; }
}

.vocab-bottom-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: #4caf50;
  border-radius: 2px 2px 0 0;
  animation: pulse-line 1.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}

.vocab-card-wrap {
  aspect-ratio: 1;
  perspective: 800px;
  cursor: pointer;
  outline: none;
  transition: opacity 0.8s ease;
}

.vocab-card-wrap.is-removing {
  opacity: 0;
  pointer-events: none;
}

.vocab-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.vocab-card-wrap.is-flipped .vocab-card {
  transform: rotateY(180deg);
}

.vocab-card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #1a1f2b;
  border-radius: 0.5rem;
  text-align: center;
}

.vocab-card__face--back {
  transform: rotateY(180deg);
}

.vocab-card__primary {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  font-family: "Noto Sans SC", sans-serif;
}

.vocab-card__translation {
  font-size: 1.5rem;
  line-height: 1.25;
  color: #e8eaed;
}

.vocab-card__translation-sub {
  font-size: 0.68rem;
  color: #66bb6a;
  line-height: 1.2;
  font-style: italic;
}

.vocab-card__freq {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  font-size: 0.65rem;
  color: #5c6370;
  z-index: 2;
}

.vocab-card__rank {
  position: absolute;
  top: 0.35rem;
  left: 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #69f0ae;
  z-index: 2;
}

.vocab-card__hsk {
  position: absolute;
  bottom: 0.35rem;
  right: 0.45rem;
  font-size: 0.6rem;
  font-weight: 700;
  color: #90caf9;
  letter-spacing: 0.05em;
}

/* Top spacer — gives scroll room above the first card so all cards can exit from the bottom */
.vocab-top-spacer {
  grid-column: 1 / -1;
  height: 90vh;
  flex-shrink: 0;
}

/* Glitter particles */
@keyframes glitter-particle {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

.glitter-particle {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: glitter-particle 0.55s ease-out forwards;
}

/* Floating +1 label (bottom of screen, green) */
@keyframes float-up {
  0%   { transform: translateX(-50%) translateY(0)     scale(1);   opacity: 1; }
  100% { transform: translateX(-50%) translateY(-70px) scale(1.9); opacity: 0; }
}

.vocab-plus-one {
  position: fixed;
  font-size: 1.5rem;
  font-weight: 900;
  color: #69f0ae;
  text-shadow: 0 0 12px #69f0ae80;
  pointer-events: none;
  z-index: 9999;
  animation: float-up 0.85s ease-out forwards;
}

/* Floating -1 label (card center, red) */
@keyframes minus-one {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 70px)) scale(1.9); opacity: 0; }
}

.vocab-minus-one {
  position: fixed;
  font-size: 1.5rem;
  font-weight: 900;
  color: #ef5350;
  text-shadow: 0 0 12px #ef535080;
  pointer-events: none;
  z-index: 9999;
  animation: minus-one 0.85s ease-out forwards;
}

/* Speech bubble (no-vocab message + post-fireworks prompts) */
.vocab-speech-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 24px)) scale(0.88);
  background: #1a1f2b;
  border: 1px solid #4caf5055;
  border-radius: 1.1rem;
  padding: 1.5rem 2.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #e8eaed;
  text-align: center;
  box-shadow: 0 8px 40px #00000090, 0 0 20px #4caf5018;
  cursor: pointer;
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  user-select: none;
}

/* Tail pointing downward */
.vocab-speech-bubble::before {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border: 14px solid transparent;
  border-top-color: #4caf5055;
  border-bottom: 0;
}

.vocab-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  border: 13px solid transparent;
  border-top-color: #1a1f2b;
  border-bottom: 0;
}

.vocab-speech-bubble.visible {
  opacity: 1;
  transform: translate(-50%, calc(-50% - 24px)) scale(1);
}
