.dtc-hero {
  margin-bottom: var(--space-4);
}

.dtc-search-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}

.dtc-search {
  position: relative;
  display: flex;
  align-items: center;
}

.dtc-search__icon {
  position: absolute;
  left: 16px;
  display: inline-flex;
  color: var(--text-tertiary);
  pointer-events: none;
}

.dtc-search__icon svg {
  width: 20px;
  height: 20px;
}

.dtc-search__input {
  width: 100%;
  padding: 15px 46px 15px 46px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.02rem;
  color: var(--text);
  background: var(--bg, #fff);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dtc-search__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.dtc-search__clear {
  position: absolute;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-secondary);
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.dtc-search__clear:hover {
  background: #e2e8f0;
}

.dtc-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.dtc-fams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dtc-fam {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dtc-fam b {
  color: var(--text);
  font-weight: 800;
}

.dtc-fam__n {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--surface-2, #f1f5f9);
  border-radius: 999px;
  padding: 1px 7px;
}

.dtc-fam:hover {
  border-color: var(--brand);
}

.dtc-fam.is-active {
  border-color: var(--brand);
  background: var(--brand);
}

.dtc-fam.is-active,
.dtc-fam.is-active b {
  color: #fff;
}

.dtc-fam.is-active .dtc-fam__n {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.dtc-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dtc-brand select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  max-width: 240px;
}

.dtc-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-3);
}

.dtc-quick__label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-weight: 600;
}

.dtc-quick__chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand-deep);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dtc-quick__chip:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.dtc-resultbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.dtc-db-note {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.dtc-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  -webkit-user-select: none;
  user-select: none;
}

.dtc-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-6) var(--space-4);
  font-size: 0.95rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.dtc-more {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: var(--space-3) 0 var(--space-2);
}

.dtc-more__btn,
.dtc-more__all {
  border-radius: 999px;
  padding: 11px 22px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dtc-more__btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

.dtc-more__btn:hover {
  background: var(--brand-deep);
}

.dtc-more__all {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand-deep);
}

.dtc-more__all:hover {
  border-color: var(--brand);
}

.dtc-more__btn:focus-visible,
.dtc-more__all:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.dtc-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--fam-accent, var(--brand));
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 15px;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.dtc-card.is-clickable {
  cursor: pointer;
}

.dtc-card.is-clickable:hover,
.dtc-card.is-clickable:focus-visible {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
  border-color: color-mix(in srgb, var(--fam-accent, var(--brand)) 45%, var(--border));
}

.dtc-card[data-fam="P"] {
  --fam-accent: #0ea5e9;
}
.dtc-card[data-fam="C"] {
  --fam-accent: #f59e0b;
}
.dtc-card[data-fam="B"] {
  --fam-accent: #8b5cf6;
}
.dtc-card[data-fam="U"] {
  --fam-accent: #10b981;
}

.dtc-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dtc-card__code {
  font-family: var(--font-mono, monospace);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--fam-accent, var(--text));
  letter-spacing: 0.5px;
}

.dtc-card__tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dtc-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-secondary);
}

.dtc-tag--fam {
  background: color-mix(in srgb, var(--fam-accent) 15%, transparent);
  color: var(--fam-accent);
}

.dtc-tag--mfr {
  background: #fef3c7;
  color: #b45309;
}

.dtc-tag--brand {
  background: #e0e7ff;
  color: #3730a3;
}

.dtc-card__desc {
  margin: 9px 0 6px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}

.dtc-card__meta {
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: var(--text-tertiary);
}

.dtc-card__break {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 0.74rem;
  color: var(--text-tertiary);
}

.dtc-card__break b {
  color: var(--text-secondary);
  font-weight: 700;
}

.dtc-card__hint {
  margin: 10px 0 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--brand-deep);
}

body.dtc-modal-open {
  overflow: hidden;
}

.dtc-modal[hidden] {
  display: none;
}

.dtc-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dtc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.dtc-modal.is-visible .dtc-modal__backdrop {
  opacity: 1;
}

.dtc-modal__panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 22px 18px;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.dtc-modal.is-visible .dtc-modal__panel {
  transform: none;
  opacity: 1;
}

.dtc-modal__x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dtc-modal__x:hover {
  background: #e2e8f0;
  color: var(--text);
}

.dtc-modal__eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.dtc-modal__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
  padding-right: 36px;
}

.dtc-modal__code {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.1;
}

.dtc-modal[data-fam="P"] .dtc-modal__code { color: #0ea5e9; }
.dtc-modal[data-fam="C"] .dtc-modal__code { color: #f59e0b; }
.dtc-modal[data-fam="B"] .dtc-modal__code { color: #8b5cf6; }
.dtc-modal[data-fam="U"] .dtc-modal__code { color: #10b981; }

.dtc-modal__tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dtc-modal__desc {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--text);
}

.dtc-modal__break {
  margin-bottom: 14px;
}

.dtc-modal__break-inner,
.dtc-modal__break .dtc-card__break {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 12px 0 0;
  border-top: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.dtc-modal__break-inner b,
.dtc-modal__break .dtc-card__break b {
  color: var(--text-secondary);
  font-weight: 700;
}

.dtc-modal__guide {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.dtc-modal__block {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2, #f8fafc);
}

.dtc-modal__block h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text);
}

.dtc-modal__block ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dtc-modal__block li + li {
  margin-top: 4px;
}

.dtc-modal__related {
  margin-bottom: 14px;
}

.dtc-modal__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dtc-modal__chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand-deep);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.dtc-modal__chip:hover {
  border-color: var(--brand);
  background: rgba(14, 165, 233, 0.06);
}

.dtc-modal__note {
  margin: 0 0 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.dtc-modal__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.dtc-modal__toolbar .btn {
  text-decoration: none;
}

.dtc-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dtc-modal__actions .btn {
  text-decoration: none;
}

@media (max-width: 560px) {
  .dtc-modal {
    padding: 12px;
    align-items: end;
  }

  .dtc-modal__panel {
    width: 100%;
    max-height: 86vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dtc-modal__actions {
    flex-direction: column-reverse;
  }

  .dtc-modal__actions .btn,
  .dtc-modal__toolbar .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* ===== Learn / how-to-read ===== */
.dtc-learn {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin: 0 0 var(--space-4);
  overflow: hidden;
}

.dtc-learn--top {
  margin-top: -4px;
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.dtc-learn--top:not([open]) {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-color: rgba(14, 165, 233, 0.22);
}

.dtc-learn--top:not([open]) .dtc-learn__summary {
  padding: 12px 16px;
}

.dtc-learn--top .dtc-learn__summary-title {
  color: var(--brand-deep);
}

.dtc-learn__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 18px;
  font-weight: 800;
  color: var(--text);
}

.dtc-learn__summary::-webkit-details-marker {
  display: none;
}

.dtc-learn__summary::after {
  content: "";
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-left: auto;
  border-right: 2px solid var(--text-tertiary);
  border-bottom: 2px solid var(--text-tertiary);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.dtc-learn[open] .dtc-learn__summary::after {
  transform: rotate(-135deg);
  margin-top: 6px;
}

.dtc-learn__summary-title {
  font-size: 1.05rem;
}

.dtc-learn__summary-hint {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.dtc-learn[open] .dtc-learn__summary {
  border-bottom: 1px solid var(--border);
}

.dtc-learn__body {
  padding: 18px;
}

.dtc-learn__title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 var(--space-2);
}

.dtc-learn__intro {
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 760px;
  margin: 0 0 var(--space-4);
}

.dtc-anatomy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.dtc-anatomy__code {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.dtc-anatomy__ch {
  width: 52px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, monospace);
  font-size: 2rem;
  font-weight: 800;
  border-radius: 12px;
  background: var(--surface-2, #f1f5f9);
  border-bottom: 5px solid var(--c, #94a3b8);
  color: var(--text);
}

.dtc-anatomy__ch--sys {
  --c: #0ea5e9;
}
.dtc-anatomy__ch--type {
  --c: #f59e0b;
}
.dtc-anatomy__ch--sub {
  --c: #8b5cf6;
}
.dtc-anatomy__ch--fault {
  --c: #10b981;
}

.dtc-anatomy__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.dtc-anatomy__legend li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.dtc-anatomy__legend b {
  color: var(--text);
}

.dtc-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
  transform: translateY(1px);
}

.dtc-dot--sys {
  background: #0ea5e9;
}
.dtc-dot--type {
  background: #f59e0b;
}
.dtc-dot--sub {
  background: #8b5cf6;
}
.dtc-dot--fault {
  background: #10b981;
}

.dtc-anatomy__eg {
  margin: var(--space-3) 0 0;
  padding: 10px 14px;
  background: var(--surface-2, #f1f5f9);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dtc-cards4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.dtc-fcard {
  border: 1px solid var(--border);
  border-top: 4px solid var(--c, var(--brand));
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-3);
  position: relative;
}

.dtc-fcard--P {
  --c: #0ea5e9;
}
.dtc-fcard--C {
  --c: #f59e0b;
}
.dtc-fcard--B {
  --c: #8b5cf6;
}
.dtc-fcard--U {
  --c: #10b981;
}

.dtc-fcard__k {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--c);
  color: #fff;
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.dtc-fcard h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 5px;
}

.dtc-fcard p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.dtc-learn__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.dtc-learn__block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

.dtc-learn__block h3 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
}

.dtc-learn__block p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.dtc-learn__src {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.dtc-learn__src a {
  color: var(--brand-deep);
  text-decoration: underline;
}

.dtc-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(12px);
  background: var(--dark, #0f172a);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}

.dtc-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dtc-fam:focus-visible,
.dtc-quick__chip:focus-visible,
.dtc-search__clear:focus-visible,
.dtc-brand select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .dtc-anatomy__ch {
    width: 42px;
    height: 54px;
    font-size: 1.6rem;
  }
  .dtc-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .dtc-brand {
    justify-content: space-between;
  }
  .dtc-brand select {
    max-width: none;
    flex: 1;
  }
}
