/* Static tables keep one copy of every record and become cards on narrow screens. */
body[data-rendering="static"] [hidden] { display: none !important; }
[data-static-list] { min-width: 0; scroll-margin-top: 1rem; }
[data-static-list] [data-static-count] { margin: .5rem 0; color: var(--text-muted); font-size: .82rem; text-align: right; }
[data-static-list] [data-static-reset] { min-height: 44px; padding: 8px 12px; font: inherit; cursor: pointer; }
[data-static-list] button:focus-visible,
[data-character-directory] button:focus-visible,
[data-character-directory] select:focus-visible,
[data-character-directory] input:focus-visible {
  outline: 3px solid rgba(22, 115, 185, .55);
  outline-offset: 2px;
}
[data-static-list] .character-detail { padding: 10px; }
[data-static-list] .character-detail-item { min-width: 0; }
[data-static-list] .character-name-button,
[data-character-directory] button,
[data-character-directory] .character-directory-result a { min-height: 44px; }
[data-static-list] select,
[data-character-directory] select { width: 100%; min-width: 0; max-width: 100%; }

[data-static-list] .static-single-view { display: block; width: 100%; overflow: visible; }
[data-static-list] .static-single-view .character-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}
[data-static-list] .static-single-view .character-table th,
[data-static-list] .static-single-view .character-table td { min-width: 0; overflow-wrap: anywhere; }
[data-static-list] .static-single-view .character-table tbody[data-static-item] { border-bottom: 1px solid var(--brand-light); }
[data-static-list] .static-single-view .character-table tbody[data-static-item]:last-of-type { border-bottom: 0; }
[data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:first-child > td { vertical-align: top; }
[data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:last-child > td { border-bottom: 0; }
[data-static-list] .static-single-view .character-table td[data-label]::before { content: none; }
[data-static-list] [data-static-sort] { min-height: 44px; }
[data-static-list] .character-mobile-list-head { display: none; }

body[data-page="characters"] .static-single-view th:nth-child(1),
body[data-page="characters"] .static-single-view td:nth-child(1) { width: 28%; }
body[data-page="characters"] .static-single-view th:nth-child(2),
body[data-page="characters"] .static-single-view td:nth-child(2) { width: 19%; }
body[data-page="characters"] .static-single-view th:nth-child(3),
body[data-page="characters"] .static-single-view td:nth-child(3) { width: 25%; }
body[data-page="characters"] .static-single-view th:nth-child(4),
body[data-page="characters"] .static-single-view td:nth-child(4) { width: 14%; }
body[data-page="characters"] .static-single-view th:nth-child(5),
body[data-page="characters"] .static-single-view td:nth-child(5) { width: 14%; }
body[data-page="skills"] .static-single-view th:nth-child(1),
body[data-page="skills"] .static-single-view td:nth-child(1) { width: 42%; }
body[data-page="skills"] .static-single-view th:nth-child(2),
body[data-page="skills"] .static-single-view td:nth-child(2) { width: 20%; }
body[data-page="skills"] .static-single-view th:nth-child(3),
body[data-page="skills"] .static-single-view td:nth-child(3) { width: 38%; }
body[data-page="items"] .static-single-view th:nth-child(1),
body[data-page="items"] .static-single-view td:nth-child(1) { width: 62%; }
body[data-page="items"] .static-single-view th:nth-child(2),
body[data-page="items"] .static-single-view td:nth-child(2) { width: 38%; }
body[data-page="formations"] .static-single-view th:nth-child(1),
body[data-page="formations"] .static-single-view td:nth-child(1) { width: 40%; }
body[data-page="formations"] .static-single-view th:nth-child(2),
body[data-page="formations"] .static-single-view td:nth-child(2) { width: 25%; }
body[data-page="formations"] .static-single-view th:nth-child(3),
body[data-page="formations"] .static-single-view td:nth-child(3) { width: 35%; }
body[data-page="scouts"] .static-single-view th:nth-child(1),
body[data-page="scouts"] .static-single-view td:nth-child(1) { width: 22%; }
body[data-page="scouts"] .static-single-view th:nth-child(2),
body[data-page="scouts"] .static-single-view td:nth-child(2) { width: 22%; }
body[data-page="scouts"] .static-single-view th:nth-child(3),
body[data-page="scouts"] .static-single-view td:nth-child(3) { width: 16%; }
body[data-page="scouts"] .static-single-view th:nth-child(4),
body[data-page="scouts"] .static-single-view td:nth-child(4) { width: 16%; }
body[data-page="scouts"] .static-single-view th:nth-child(5),
body[data-page="scouts"] .static-single-view td:nth-child(5) { width: 24%; }
body[data-page="chronicle"] .static-single-view th:nth-child(1),
body[data-page="chronicle"] .static-single-view td:nth-child(1) { width: 42%; }
body[data-page="chronicle"] .static-single-view th:nth-child(2),
body[data-page="chronicle"] .static-single-view td:nth-child(2) { width: 14%; }
body[data-page="chronicle"] .static-single-view th:nth-child(3),
body[data-page="chronicle"] .static-single-view td:nth-child(3) { width: 44%; }
body[data-page="activities"] .static-single-view th:nth-child(1),
body[data-page="activities"] .static-single-view td:nth-child(1) { width: 55%; }
body[data-page="activities"] .static-single-view th:nth-child(2),
body[data-page="activities"] .static-single-view td:nth-child(2) { width: 45%; }

.character-directory-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.character-directory-group { display: grid; gap: 5px; min-width: 0; min-height: 76px; padding: 12px 14px; border: 1px solid var(--brand-light); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; }
.character-directory-group:hover,
.character-directory-group:focus-visible { border-color: var(--brand); background: #f1f9ff; }
.character-directory-group:focus-visible { outline: 3px solid rgba(22, 115, 185, .55); outline-offset: 2px; }
.character-directory-group-title { margin: 0; color: var(--accent); font-size: 1rem; line-height: 1.4; }
.character-directory-group-note { margin: 0; color: var(--text-muted); font-size: .84rem; line-height: 1.45; }
.character-directory-help { margin: 0 0 8px; color: var(--text-muted); font-size: .88rem; line-height: 1.5; }
.character-directory-results { min-width: 0; }
.character-directory-results-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.character-directory-result a { display: grid; gap: 5px; min-width: 0; padding: 10px 12px; border: 1px solid var(--brand-light); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; }
.character-directory-result a:hover,
.character-directory-result a:focus-visible { border-color: var(--brand); background: #f1f9ff; }
.character-directory-result-name { color: var(--accent); font-weight: 900; overflow-wrap: anywhere; }
.character-directory-result-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--text-main); font-size: .84rem; line-height: 1.4; }
.character-directory-result-meta span { min-width: 0; overflow-wrap: anywhere; }
.character-directory-status { min-height: 1.5em; margin: 8px 0; color: var(--text-muted); font-size: .88rem; }
.character-directory-more { display: block; min-width: min(100%, 18rem); min-height: 44px; margin: 12px auto 0; padding: 8px 16px; border: 2px solid var(--brand); border-radius: 999px; background: #fff; color: var(--accent); font: inherit; font-weight: 800; cursor: pointer; }

@media (max-width: 850px) {
  [data-static-list] .character-mobile-list-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
  [data-static-list] .static-single-view .character-table { display: block; }
  [data-static-list] .static-single-view .character-table thead { display: none; }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] {
    display: grid;
    gap: 0;
    margin-bottom: 8px;
    overflow: hidden;
    border: 2px solid var(--brand-light);
    border-radius: 14px;
    background: #fff;
  }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:first-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 8px 10px;
  }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:first-child > td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 3px 0;
    border: 0;
    font-size: .84rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:first-child > td:first-child { grid-column: 1 / -1; color: var(--accent); font-size: .95rem; }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:first-child > td[data-label]::before {
    content: attr(data-label) "：";
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 800;
  }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:last-child { display: block; }
  [data-static-list] .static-single-view .character-table tbody[data-static-item] > tr:last-child > td { display: block; width: auto; padding: 0 !important; }
  [data-static-list] .static-single-view .character-table .character-detail { grid-template-columns: minmax(0, 1fr); padding: 8px 10px 10px; }
  [data-static-list] .static-single-view .character-table .character-detail-item { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .character-directory-groups { grid-template-columns: minmax(0, 1fr); }
  body[data-rendering="static"] [data-character-directory] .character-filter-grid { grid-template-columns: minmax(0, 1fr); }
  .character-directory-result-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

body[data-rendering="static"] .static-page-kind { display: inline-block; }
