.kdb {
  margin: 0;
  min-height: 100vh;
  background: #f5f1ea;
  color: #282522;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.kdb * {
  box-sizing: border-box;
}

.kdb-header {
  display: grid;
  gap: 20px;
  padding: 28px 18px 22px;
  background: linear-gradient(135deg, #fffaf2, #eadfd4);
  border-bottom: 1px solid #ded1c2;
}

.kdb-eyebrow {
  margin: 0 0 6px;
  color: #8c4a4a;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kdb h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1;
}

.kdb-lead {
  max-width: 760px;
  margin: 12px 0 0;
  color: #5c5550;
  line-height: 1.75;
}

.kdb-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kdb-header-side {
  display: grid;
  gap: 10px;
}

.kdb-stats div {
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e4d6c8;
  border-radius: 8px;
}

.kdb-stats strong,
.kdb-stats span {
  display: block;
}

.kdb-stats strong {
  font-size: 1.4rem;
}

.kdb-stats span {
  color: #756c64;
  font-size: 0.8rem;
}

.kdb-hulu-status {
  padding: 12px;
  background: #fffaf5;
  border: 1px solid #e1d4c6;
  border-radius: 8px;
  color: #5b5149;
  line-height: 1.45;
}

.kdb-hulu-status-title {
  color: #8c4a4a;
  font-size: 0.78rem;
  font-weight: 700;
}

.kdb-hulu-status-main {
  margin-top: 4px;
  color: #282522;
  font-weight: 700;
}

.kdb-hulu-status-meta {
  margin-top: 3px;
  font-size: 0.82rem;
}

.kdb-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 20px auto 40px;
}

.kdb-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  background: #fffaf5;
  border: 1px solid #e1d4c6;
  border-radius: 8px;
}

.kdb-field {
  display: grid;
  gap: 6px;
}

.kdb-search-field {
  position: relative;
}

.kdb-field span,
.kdb-checks legend {
  color: #655b52;
  font-size: 0.78rem;
  font-weight: 700;
}

.kdb input,
.kdb select,
.kdb button {
  min-height: 42px;
  border: 1px solid #cdbfb2;
  border-radius: 6px;
  background: #fff;
  color: #282522;
  font: inherit;
}

.kdb input,
.kdb select {
  width: 100%;
  padding: 0 10px;
}

.kdb-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: min(420px, 68vh);
  overflow: auto;
  padding: 6px;
  background: #fffdf9;
  border: 1px solid #cdbfb2;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(76, 58, 43, 0.16);
}

.kdb-suggestions[hidden] {
  display: none;
}

.kdb-suggestion-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  width: 100%;
  min-height: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.kdb-suggestion-item:hover,
.kdb-suggestion-item:focus-visible {
  background: #f4ece1;
  outline: none;
}

.kdb-suggestion-kind {
  align-self: start;
  padding: 2px 6px;
  border-radius: 999px;
  background: #6e5147;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.kdb-suggestion-main {
  overflow: hidden;
  color: #282522;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kdb-suggestion-meta {
  grid-column: 2;
  overflow: hidden;
  color: #756c64;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kdb-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d9cbbb;
  border-radius: 6px;
}

.kdb-provider-checks {
  grid-column: 1 / -1;
}

.kdb-checks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
}

.kdb-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}

.kdb-filter-notice {
  margin-top: 4px;
  color: #8c4a4a;
  font-size: 0.86rem;
  line-height: 1.5;
}

.kdb-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.kdb-results-bar button {
  padding: 0 14px;
  cursor: pointer;
}

.kdb-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.kdb-bottom-actions {
  display: flex;
  justify-content: center;
  margin: 22px 0 6px;
}

.kdb-bottom-actions button {
  min-width: 180px;
  padding: 0 18px;
  cursor: pointer;
}

.kdb-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  overflow: hidden;
  background: #fffdf9;
  border: 1px solid #e0d3c5;
  border-radius: 8px;
}

.kdb-poster {
  background: #d8c9b9;
  min-height: 168px;
}

.kdb-poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kdb-poster-missing {
  display: grid;
  place-items: center;
  height: 100%;
  color: #756c64;
  font-size: 0.85rem;
}

.kdb-card-body {
  min-width: 0;
  padding: 12px;
}

.kdb-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.kdb-card h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.kdb-title-row span {
  flex: 0 0 auto;
  color: #8c4a4a;
  font-weight: 700;
}

.kdb-subtitle,
.kdb-overview,
.kdb-cast,
.kdb-memo {
  margin: 8px 0 0;
}

.kdb-subtitle,
.kdb-cast {
  color: #6b625b;
  font-size: 0.88rem;
}

.kdb-overview {
  display: -webkit-box;
  overflow: hidden;
  color: #4f4944;
  font-size: 0.92rem;
  line-height: 1.58;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.kdb-meta,
.kdb-local,
.kdb-tags,
.kdb-providers,
.kdb-classification {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.kdb-meta span,
.kdb-status,
.kdb-flag,
.kdb-tags span,
.kdb-providers span,
.kdb-classification span {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 0.76rem;
}

.kdb-meta span {
  background: #f1eadf;
  color: #5b5149;
}

.kdb-providers span {
  background: #e5edf3;
  color: #344d61;
  font-weight: 700;
}

.kdb-classification span {
  background: #f0e2cd;
  color: #6b4e2e;
  font-weight: 700;
}

.kdb-status {
  background: #6e5147;
  color: #fff;
}

.kdb-stars {
  color: #9c5a20;
  font-size: 0.86rem;
  font-weight: 700;
}

.kdb-flag {
  background: #f2dad7;
  color: #7f3838;
}

.kdb-tags span {
  background: #e8efe5;
  color: #486141;
}

.kdb-memo {
  padding-left: 10px;
  border-left: 3px solid #d6b6ad;
  color: #5b5149;
  font-size: 0.9rem;
  line-height: 1.55;
}

.kdb-link {
  display: inline-block;
  margin-top: 10px;
  color: #8c4a4a;
  font-weight: 700;
  text-decoration: none;
}

.kdb-empty {
  padding: 28px;
  background: #fffaf5;
  border: 1px solid #e1d4c6;
  border-radius: 8px;
}

.kdb-empty h2 {
  margin: 0 0 8px;
}

.kdb-empty p {
  margin: 0;
  color: #675e55;
}

.kdb-footer {
  padding: 24px 18px 34px;
  color: #6b625b;
  font-size: 0.86rem;
  line-height: 1.6;
  text-align: center;
}

.kdb-footer p {
  margin: 6px auto;
  max-width: 860px;
}

@media (min-width: 760px) {
  .kdb-header {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: end;
    padding: 42px min(5vw, 52px) 30px;
  }

  .kdb-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .kdb-field-wide {
    grid-column: span 2;
  }

  .kdb-checks {
    grid-column: span 2;
  }

  .kdb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kdb-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

@media (min-width: 1080px) {
  .kdb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kdb-card {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}
