body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #222;
  margin: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

h1 {
  margin-bottom: 8px;
}

.description,
.subtitle {
  color: #666;
}

.search-form {
  display: flex;
  gap: 8px;
  margin: 24px 0;
}

.search-form input {
  flex: 1;
  font-size: 16px;
  padding: 10px;
}

.search-form button {
  font-size: 16px;
  padding: 10px 18px;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  border: 1px solid #ddd;
  padding: 8px;
  vertical-align: top;
}

th {
  background: #eef2f7;
  color: #222;
  white-space: nowrap;
}

th a {
  color: #222;
  font-weight: 700;
  text-decoration: none;
}

th a:hover {
  color: #0b5cad;
  text-decoration: underline;
}

tr:nth-child(even) {
  background: #fafafa;
}

a {
  color: #0b5cad;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.number {
  text-align: right;
}

.no-results {
  background: white;
  padding: 16px;
  border-left: 4px solid #999;
}

.card {
  background: white;
  padding: 20px;
  margin: 20px 0;
  border-radius: 6px;
}

dl {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 8px 16px;
}

dt {
  font-weight: bold;
  color: #444;
}

dd {
  margin: 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.language-link {
  display: inline-block;
  padding: 8px 12px;
  background: #222;
  color: white;
  border-radius: 4px;
  text-decoration: none;
}

.language-link:hover {
  background: #444;
  text-decoration: none;
}

.untranslated {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 5px;
  font-size: 0.75em;
  color: #666;
  background: #eee;
  border-radius: 3px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-cards {
  display: none;
}

.npc-card {
  background: white;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.npc-card h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.npc-card-subtitle {
  margin: 0 0 4px;
  color: #666;
}

.npc-card-id {
  margin: 0 0 12px;
  color: #555;
  word-break: break-all;
}

.npc-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.npc-card-grid div {
  background: #f7f7f7;
  padding: 8px;
  border-radius: 6px;
}

.npc-card-grid span {
  display: block;
  color: #666;
  font-size: 0.8rem;
  margin-bottom: 3px;
}

.npc-card-grid strong {
  display: block;
  color: #222;
  font-size: 0.95rem;
}

@media (max-width: 760px) {
  .container {
    padding: 14px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-form {
    flex-direction: column;
  }

  .desktop-table {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  .npc-card-grid {
    grid-template-columns: 1fr;
  }
}

.ad-slot {
  background: #f0f0f0;
  color: #777;
  border: 1px dashed #bbb;
  border-radius: 6px;
  padding: 16px;
  margin: 20px 0;
  text-align: center;
  font-size: 0.9rem;
}

.note-card,
.source-note {
  font-size: 0.95rem;
}

.source-note p {
  line-height: 1.7;
}

@media (max-width: 760px) {
  dl {
    display: block;
  }

  dt {
    margin-top: 12px;
  }

  dd {
    margin-top: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
  }

  .card {
    padding: 16px;
    margin: 14px 0;
  }

  .ad-slot {
    margin: 14px 0;
    padding: 14px;
  }
}

.top-source-note {
  background: white;
  border-left: 4px solid #999;
  padding: 12px 14px;
  margin: 16px 0;
  color: #444;
  line-height: 1.7;
  font-size: 0.92rem;
}

/* ---- README / stats / table layout improvement ---- */

.db-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.stat-card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 14px;
  background: #fafafa;
  min-width: 180px;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.15rem;
}

.result-count {
  margin: 6px 0 12px;
  color: #555;
  font-weight: 600;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.desktop-table table {
  min-width: 1500px;
  table-layout: fixed;
}

.desktop-table th,
.desktop-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.desktop-table th:nth-child(1),
.desktop-table td:nth-child(1) {
  width: 220px;
}

.desktop-table th:nth-child(2),
.desktop-table td:nth-child(2) {
  width: 220px;
}

.desktop-table th:nth-child(3),
.desktop-table td:nth-child(3) {
  width: 280px;
}

.desktop-table th:nth-child(4),
.desktop-table td:nth-child(4),
.desktop-table th:nth-child(6),
.desktop-table td:nth-child(6) {
  width: 90px;
}

.desktop-table th:nth-child(5),
.desktop-table td:nth-child(5) {
  width: 130px;
}

.desktop-table th:nth-child(n+7),
.desktop-table td:nth-child(n+7) {
  width: 95px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.number {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .db-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    min-width: 0;
  }
}

