.section-type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

.section-type-basic-sentence        { background: #e3f2fd; color: #1565c0; }
.section-type-variation-drill       { background: #f3e5f5; color: #7b1fa2; }
.section-type-translation-drill     { background: #e8f5e9; color: #2e7d32; }
.section-type-response-drill        { background: #fff3e0; color: #e65100; }
.section-type-substitution-drill    { background: #e0f7fa; color: #006064; }
.section-type-conversation-practice { background: #fce4ec; color: #880e4f; }
.section-type-situations            { background: #fff8e1; color: #f57f17; }
.section-type-finder-list           { background: #ede7f6; color: #4527a0; }
.section-type-note                  { background: #f5f5f5; color: #546e7a; }

/* Units Index — Card Grid */

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.unit-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 0;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  position: relative;
  overflow: hidden;
}


.unit-card-bg-number {
  position: absolute;
  top: -0.75rem;
  right: -0.5rem;
  font-size: 6rem;
  font-weight: 800;
  color: #e5e7eb;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.04em;
  z-index: 0;
}

.unit-card-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.6rem 0;
}

.unit-card:hover {
  border-color: #c7d9f5;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09), 0 16px 40px rgba(25, 118, 210, 0.1);
}

.unit-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1976d2;
  margin-bottom: 0.5rem;
}

.unit-card-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: auto;
  line-height: 1.35;
  padding-bottom: 1.1rem;
}

.unit-card-description {
  font-size: 0.88rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.6;
}

.unit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0.65rem 1.6rem;
  border-radius: 0 0 14px 14px;
}

.unit-card-meta {
  font-size: 0.75rem;
  color: #1a1a2e;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.unit-card-arrow {
  font-size: 0.95rem;
  color: #d1d5db;
  transition: color 0.15s, transform 0.15s;
}

.unit-card:hover .unit-card-arrow {
  color: #1976d2;
  transform: translateX(4px);
}

.unit-card.unit-card-coming-soon {
  background: #f3f4f6;
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

.unit-card-coming-soon-badge {
  font-size: 0.75rem;
  color: #1a1a2e;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Unit Show — Sections List */

.sections-list-header {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9e9e9e;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.sections-list {
  display: flex;
  flex-direction: column;
}

.section-row {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  color: inherit;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: border-color 0.18s, box-shadow 0.18s;
}


.section-row:hover {
  border-color: #c7d9f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(25, 118, 210, 0.1);
}

.section-row-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}

.section-row-number {
  font-size: 0.82rem;
  font-weight: 600;
  color: #bdbdbd;
  min-width: 1.75rem;
  flex-shrink: 0;
}

.section-row-title {
  flex: 1;
  font-weight: 700;
  font-size: 1.3rem;
  color: #1a1a2e;
  text-align: center;
}

.section-row-arrow {
  color: #bdbdbd;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}

.section-row:hover .section-row-arrow {
  color: #1976d2;
  transform: translateX(2px);
}

/* Section preview thumbnail */

.section-preview-frame {
  padding: 0;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  height: 250px;
  overflow: hidden;
  width: 66%;
  margin: auto auto 0;
}

.section-preview-content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  pointer-events: none;
  user-select: none;
  padding: 0.75rem 1.25rem 1rem;
  font-size: 0.72rem;
}

.section-preview-content .basic-sentence-item {
  gap: 0.75rem;
  padding: 0.1rem 0;
}

.section-preview-content .audio-btn {
  font-size: 0.6rem;
  padding: 0.1rem 0.3rem;
}

.section-preview-content .basic-sentence-division {
  margin-bottom: 0.5rem;
}

.section-preview-content .basic-sentence-division h3 {
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.section-preview-content .finder-list-table th { font-size: 0.6rem; padding-bottom: 0.2rem; }

.section-preview-content .audio-btn {
  width: 18px;
  height: 18px;
  font-size: 0.5rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.section-preview-content .variation-drill-group { margin-bottom: 0.5rem; padding-top: 0.4rem; }
.section-preview-content .variation-drill-item { margin-bottom: 0.3rem; }
.section-preview-content .variation-drill-base { gap: 0.75rem; padding: 0.1rem 0; margin-bottom: 0.2rem; }
.section-preview-content .variation-drill-number { margin-bottom: 0.2rem; }
.section-preview-content .variation-drill-sentences td { padding: 0.05rem 0.25rem; }

.section-preview-content h1 { font-size: 1rem; margin: 0 0 0.2rem; }
.section-preview-content h2 { font-size: 0.9rem; margin: 0 0 0.2rem; }
.section-preview-content h3 { font-size: 0.8rem; margin: 0 0 0.15rem; }
.section-preview-content h4,
.section-preview-content h5,
.section-preview-content h6 { font-size: 0.75rem; margin: 0 0 0.1rem; }
.section-preview-content p { margin: 0 0 0.2rem; }


.preview-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.82rem;
  color: #374151;
  overflow: hidden;
}

.preview-row--block {
  flex-direction: column;
  gap: 0.15rem;
  white-space: normal;
}

.preview-num {
  font-size: 0.72rem;
  color: #bdbdbd;
  flex-shrink: 0;
}

.preview-en {
  color: #6b7280;
  flex-shrink: 0;
}

.preview-de {
  font-weight: 500;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-answer {
  color: #555;
  font-weight: 400;
}

.preview-speaker {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
}

.preview-muted {
  font-size: 0.78rem;
  color: #9ca3af;
}

.preview-note {
  font-size: 0.82rem;
  color: #4b5563;
  margin: 0;
  line-height: 1.5;
}

/* Section Show — Layout */

.section-card-tab-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-card-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 90%;
  text-align: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.45rem 1.25rem;
  font-size: 0.82rem;
  transition: background 0.15s;
}


.section-card-tab-link--primary,
.section-card-tab-link--secondary {
  font-weight: 700;
  color: #1976d2;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.section-card-tab-link--primary:hover,
.section-card-tab-link--secondary:hover {
  color: #1251a0;
}

.section-card-tab-sep {
  color: #bdbdbd;
  font-weight: 400;
}

.section-card-tab-wrapper .section-content {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px 12px 0 0;
  border-bottom: none;
  padding: 2rem 2.25rem 0;
  margin-bottom: -3rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.section-card-tab-wrapper .section-content::after {
  content: "";
  display: block;
  border-top: 1px solid #e5e7eb;
  margin: 2rem -2.25rem 0;
  padding-bottom: 8rem;
}

.unit-show-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px 12px 0 0;
  border-bottom: none;
  padding: 2rem 0 0;
  margin-bottom: -3rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  overflow: hidden;
}

.unit-show-card .section-show-title-row {
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  justify-content: center;
  border-bottom: none;
  margin-bottom: 0;
}

.unit-show-card .unit-card {
  flex-direction: column;
  padding: 1.6rem 1.6rem 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  box-shadow: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.unit-show-card .unit-card-title {
  text-align: left;
  padding-bottom: 0.75rem;
  margin-bottom: 0;
}

.unit-show-card .unit-card-bottom {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: calc(100% + 1.6rem);
  margin-left: -1.6rem;
  margin-right: -1.6rem;
}

.unit-show-card .unit-card-description {
  flex: 1;
  padding: 0.75rem 1.6rem 1.25rem;
  margin: 0;
  align-self: flex-start;
}

.unit-show-card .section-preview-frame {
  flex: 2;
  height: 250px;
  margin: 0;
  border-top: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.unit-show-card .unit-card:hover {
  background: #f8faff;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(25, 118, 210, 0.12);
  z-index: 1;
  position: relative;
}

.unit-show-card .unit-card:last-child {
  border-bottom: 1px solid #e5e7eb;
}

.unit-show-card .sections-list {
  padding-bottom: 10rem;
}

.unit-show-card .unit-card:first-child {
  border-top: 1px solid #e5e7eb;
}

.section-show-title-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 1.25rem;
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  margin-bottom: 1.5rem;
  margin-left: -2.25rem;
  margin-right: -2.25rem;
  border-bottom: 1px solid #e0e0e0;
}

.section-show-title-row h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a2e;
}


.section-description-row {
  padding-bottom: 1.25rem;
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  margin-bottom: 1.5rem;
  margin-left: -2.25rem;
  margin-right: -2.25rem;
  border-bottom: 1px solid #e0e0e0;
}

.section-description {
  margin: 0;
  color: #4a4a6a;
  font-size: 1rem;
  line-height: 1.6;
}

.section-drill-link {
  font-size: 0.95rem;
  color: #1976d2;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.section-drill-link:hover {
  color: #1251a0;
  text-decoration: underline;
}

.section-content {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  min-height: 200px;
}

/* Section Bottom Nav */

.section-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  overflow-x: auto;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  z-index: 200;
  scrollbar-width: none;
}

.section-bottom-nav::-webkit-scrollbar {
  display: none;
}

.section-bottom-tab {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  background: #f3f4f6;
  color: #9ca3af;
  border-right: 1px solid #e5e7eb;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-bottom-tab:last-child {
  border-right: none;
}

.section-bottom-tab:nth-child(9n+1) { --tab-color: #ef4444; }
.section-bottom-tab:nth-child(9n+2) { --tab-color: #f97316; }
.section-bottom-tab:nth-child(9n+3) { --tab-color: #eab308; }
.section-bottom-tab:nth-child(9n+4) { --tab-color: #10b981; }
.section-bottom-tab:nth-child(9n+5) { --tab-color: #06b6d4; }
.section-bottom-tab:nth-child(9n+6) { --tab-color: #3b82f6; }
.section-bottom-tab:nth-child(9n+7) { --tab-color: #8b5cf6; }
.section-bottom-tab:nth-child(9n+8) { --tab-color: #ec4899; }
.section-bottom-tab:nth-child(9n+9) { --tab-color: #64748b; }

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

.section-bottom-tab.active {
  background: var(--tab-color);
  color: #fff;
  border-top: 3px solid rgba(0, 0, 0, 0.15);
  z-index: 1;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
}

.section-bottom-tab-title {
  font-size: 0.72rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Section Navigation */

.section-nav {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 100;
}

.section-nav-prev,
.section-nav-next {
  pointer-events: auto;
}

.section-nav-next {
  display: flex;
  justify-content: flex-end;
}

.section-nav-prev .section-nav-link {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.section-nav-next .section-nav-link {
  border-radius: 8px 0 0 8px;
  border-right: none;
}


.section-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  color: #1a1a2e;
  text-decoration: none;
  background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  transition: border-color 0.18s, box-shadow 0.18s, color 0.18s;
}

.section-nav-link:hover {
  border-color: #1976d2;
  color: #1976d2;
  box-shadow: 0 4px 16px rgba(25, 118, 210, 0.12);
}

.section-nav-arrow {
  font-size: 1.1rem;
  color: #bdbdbd;
  transition: color 0.18s;
  flex-shrink: 0;
}

.section-nav-link:hover .section-nav-arrow {
  color: #1976d2;
}

.section-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #9e9e9e;
  display: block;
}

.section-nav-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 160px;
}

/* Situations & Conversation Practice */

.situation-title,
.conversation-practice-bout {
  text-align: center;
}

.conversation-practice-table {
  width: 100%;
  border-collapse: collapse;
}

.conversation-practice-table td {
  padding: 0.25rem 0.5rem 0.25rem 0;
  vertical-align: top;
}

.conversation-speaker {
  white-space: nowrap;
}

.conversation-text {
  width: 100%;
}

.conversation-practice-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.conversation-practice-table tr:hover {
  background: #e3f2fd;
}

@media (max-width: 600px) {
  .conversation-practice-table,
  .conversation-practice-table tbody {
    display: block;
  }

  .conversation-practice-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.4rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f5f5f5;
  }

  .conversation-practice-table td {
    display: block;
    padding: 0;
  }

  .conversation-speaker {
    flex-shrink: 0;
  }

  .conversation-text {
    flex: 1;
    min-width: 0;
  }

  .conversation-practice-table tr td:last-child {
    flex-basis: 100%;
    padding-left: 0;
    padding-top: 0.2rem;
  }
}

/* Empty States */

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #9e9e9e;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* Finder List */

.finder-list-table {
  width: 100%;
  border-collapse: collapse;
}

.finder-list-table th,
.finder-list-table td {
  padding: 0.3rem 0.5rem 0.3rem 0;
  vertical-align: top;
}

.finder-list-prefix {
  white-space: nowrap;
  text-align: right;
  padding-right: 0.6rem;
  color: #555;
  min-width: 60px;
}

.finder-list-german {
  white-space: nowrap;
  font-weight: 500;
  padding-right: 1rem;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.finder-list-english {
  color: #555;
}

.finder-list-table th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.finder-list-entry:hover,
.finder-list-child:hover {
  background: #e3f2fd;
}

/* Responsive */

@media (max-width: 600px) {
  .section-show-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .section-show-title-row h1 {
    font-size: 1.4rem;
  }

  .units-grid {
    grid-template-columns: 1fr;
  }

  .section-content {
    padding: 1.25rem 1rem;
  }

  /* Hide the fixed side-arrow nav — bottom-nav handles section switching */
  .section-nav {
    display: none;
  }

  /* Stack section preview + description vertically; hide preview at small sizes */
  .unit-show-card .unit-card-bottom {
    flex-direction: column;
    width: auto;
    margin-left: 0;
    margin-right: 0;
  }

  .unit-show-card .unit-card-description {
    padding: 0.5rem 0 0.75rem;
    align-self: auto;
  }

  .unit-show-card .section-preview-frame {
    display: none;
  }

  /* Reset negative margins on unit-show-card title row (those margins assume a
     2.25rem-padded parent; unit-show-card has no horizontal padding, so without
     resetting them the row extends outside the overflow:hidden boundary and the
     title text gets clipped on the left) */
  .unit-show-card .section-show-title-row {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    margin-left: 0;
    margin-right: 0;
  }

  /* Fix section-card-tab padding on mobile (needs higher specificity) */
  .section-card-tab-wrapper .section-content {
    padding: 1.25rem 1rem 0;
  }

  .section-card-tab-wrapper .section-content::after {
    margin: 1.25rem -1rem 0;
  }

  /* Wrap long breadcrumb text in section/drill tab */
  .section-card-tab {
    flex-wrap: wrap;
  }

  /* Prevent finder-list overflow on narrow screens */
  .finder-list-german {
    min-width: 120px;
  }
}
