/* ============================================
   Drill (Flashcard Mode)
   ============================================ */

.drill-wrapper {
  max-width: 1200px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.drill-wrapper .section-card-tab {
  width: 90%;
}

.drill-container {
  width: 100%;
  padding: 2rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.drill-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drill-header .breadcrumb {
  justify-content: flex-start;
  margin-bottom: 0;
}

.drill-back-link {
  font-size: 0.875rem;
  color: #555;
  text-decoration: none;
}

.drill-back-link:hover {
  color: #1976d2;
}

.drill-counter {
  font-size: 0.875rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

/* Stage holds all cards; only the active one is visible */
.drill-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  /* Top/bottom padding so rotated pseudo-elements aren't clipped */
  /* Left padding makes room for the bookmark group tabs */
  padding: 10px 0;
}

/* Third card (furthest back) */
.drill-stage::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 92%;
  height: calc(100% - 20px);
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  z-index: 0;
  transform: translateX(-50%) rotate(3deg);
}

/* Second card (middle) */
.drill-stage::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 96%;
  height: calc(100% - 20px);
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  z-index: 1;
  transform: translateX(-50%) rotate(1.5deg);
}

/* Last card: hide all phantom cards */
.drill-stage[data-stack-count="0"]::before,
.drill-stage[data-stack-count="0"]::after {
  display: none;
}

/* Only one card ahead: hide the furthest-back phantom */
.drill-stage[data-stack-count="1"]::before {
  display: none;
}

.drill-card {
  position: relative;
  z-index: 2;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
  min-height: 220px;
}

.drill-group-tabs {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateX(-100%) translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  z-index: 3;
}

/* Bookmark colour palette — one hue per tab position */
.drill-group-tab:nth-child(1) { --group-color: #ef4444; }
.drill-group-tab:nth-child(2) { --group-color: #eab308; }
.drill-group-tab:nth-child(3) { --group-color: #10b981; }
.drill-group-tab:nth-child(4) { --group-color: #0ea5e9; }
.drill-group-tab:nth-child(5) { --group-color: #8b5cf6; }
.drill-group-tab:nth-child(6) { --group-color: #ec4899; }

.drill-group-tab {
  min-width: 160px;
  padding: 5px 9px 5px 10px;
  min-height: 42px;
  height: auto;
  border-radius: 6px 0 0 6px;
  border: none;
  background: #e5e7eb;
  color: #9ca3af;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: -2px 1px 5px rgba(0, 0, 0, 0.1);
}

.drill-group-tab:hover:not(.active) {
  background: var(--group-color);
  color: #fff;
}

.drill-group-tab.active {
  background: var(--group-color);
  color: #fff;
  box-shadow: -3px 1px 8px rgba(0, 0, 0, 0.28);
  transform: translateX(-4px);
}

/* Override global hotkey-badge inside bookmark tabs */
.drill-group-tab .hotkey-badge {
  margin-left: 0;
  padding: 0.15em 0.45em;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  border-bottom-width: 1px;
  color: #fff;
}

.variation-drill-item-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.variation-drill-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.variation-drill-item-de {
  font-size: 1.1rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
}

.variation-drill-item-en {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
  text-align: right;
}

.variation-mini-card {
  width: 100%;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  gap: 0.75rem;
}

.variation-mini-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.variation-mini-card__gloss {
  font-size: 1.35rem;
  font-weight: 600;
  color: #111827;
  text-align: center;
  margin: 0;
}

.variation-mini-card__empty {
  font-size: 1.2rem;
  color: #d1d5db;
  letter-spacing: 0.2em;
  margin: 0;
}

.variation-mini-card__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.variation-mini-card__text {
  font-size: 1.15rem;
  color: #1976d2;
  margin: 0;
}

.variation-nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.variation-nav-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #6b7280;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.variation-nav-btn .hotkey-badge {
  display: none;
}

.variation-nav-btn:hover:not(:disabled) {
  border-color: #1976d2;
  color: #1976d2;
}

.variation-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.variation-nav-counter {
  font-size: 0.8rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: center;
}

.basic-sentence-drill-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9ca3af;
  align-self: flex-start;
}

.drill-card-speaker {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
}

.drill-card-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.drill-card-prompt {
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0;
  color: #111827;
}

.drill-card-note {
  font-size: 0.82rem;
  color: #9ca3af;
  margin: 0;
}

.drill-card-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1.5rem;
  width: 100%;
}

.drill-card-answer {
  font-size: 1.3rem;
  color: #1976d2;
  margin: 0;
}

.drill-audio-btns {
  display: flex;
  gap: 0.5rem;
}

.drill-reveal-btn {
  background: none;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  padding: 0.4rem 1.4rem;
  font: inherit;
  font-size: 0.9rem;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.drill-reveal-btn:hover {
  border-color: #1976d2;
  color: #1976d2;
}

/* Navigation */
.drill-nav {
  display: flex;
  gap: 1rem;
}

.drill-nav-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s, color 0.15s;
}

.drill-nav-btn:hover:not(:disabled) {
  border-color: #1976d2;
  color: #1976d2;
}

.drill-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (max-width: 600px) {
  .drill-card {
    padding: 2rem 1.25rem 1.5rem;
  }

  .drill-card-prompt {
    font-size: 1.25rem;
  }

  .drill-card-answer {
    font-size: 1.15rem;
  }

  /* Reflow group tabs from left-side vertical to bottom horizontal strip */
  .drill-group-tabs {
    position: static;
    transform: none;
    flex-direction: row;
    align-self: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 0.6rem 1.25rem;
    margin: 0.5rem -1.25rem -1.5rem;
    justify-content: flex-start;
    align-items: stretch;
  }

  .drill-group-tabs::-webkit-scrollbar {
    display: none;
  }

  .drill-group-tab {
    min-width: auto;
    flex-shrink: 0;
    border-radius: 6px;
    min-height: 32px;
    padding: 4px 10px;
    box-shadow: none;
  }

  .drill-group-tab.active {
    transform: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  }
}
