/* ═══════════════════════════════════════════════════════════════
   VALYRIA — Library / World Info shared styles
   Used by: creatures.php, items.php, spells.php, npcs.php, map.php
   ═══════════════════════════════════════════════════════════════ */

/* ── Page header strip ── */
.lib-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--paper-border);
}

.lib-page-header h1 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-light);
    margin: 0;
    flex: 1;
}

.lib-count-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(201,162,39,0.10);
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
    border-radius: var(--radius-full);
    padding: 2px 10px;
    letter-spacing: 0.05em;
}

/* ── Tab row ── */
.lib-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--paper-border);
    flex-wrap: wrap;
}

.lib-tab {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    padding: 5px 14px;
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    cursor: pointer;
}

.lib-tab:hover {
    color: var(--text-primary);
    border-color: rgba(201,162,39,0.25);
    text-decoration: none;
}

.lib-tab.active,
.lib-tab[aria-current="page"] {
    color: var(--gold-light);
    border-color: var(--gold-border);
    background: rgba(201,162,39,0.08);
}

/* ── Filter / search bar ── */
.lib-filter-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--paper-border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.lib-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 360px;
}

.lib-search-wrap .fa {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

/* arcane.css styles every input[type="text"], and that selector outranks the
   .lib-input class, so its 12px padding replaced the room reserved for the
   icon and the text sat on top of it. Match it here on a stronger selector. */
.lib-search-wrap input.lib-input {
    padding: 9px 12px 9px 34px;
}

/* ── "Back to Wiki" bar, injected by header.php on every wiki page ── */
.wiki-return {
    padding: 12px 20px 0;
}

.wiki-return-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-dark);
    text-decoration: none;
    background: rgba(0,0,0,0.28);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-full);
    padding: 6px 15px;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.wiki-return-btn:hover {
    color: var(--gold-light);
    border-color: var(--gold-border);
    background: rgba(201,162,39,0.08);
    text-decoration: none;
}

.wiki-return-btn .fa {
    font-size: 0.7rem;
    transition: transform 0.18s ease;
}

.wiki-return-btn:hover .fa {
    transform: translateX(-3px);
}

@media (max-width: 560px) {
    .wiki-return { padding: 10px 14px 0; }
}

.lib-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 7px 10px 7px 30px;
    transition: border-color 0.18s ease;
}

.lib-input:focus {
    outline: none;
    border-color: rgba(201,162,39,0.4);
    background: rgba(0,0,0,0.45);
}

.lib-input::placeholder {
    color: var(--text-muted);
}

.lib-select {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 7px 10px;
    cursor: pointer;
    transition: border-color 0.18s ease;
}

.lib-select:focus {
    outline: none;
    border-color: rgba(201,162,39,0.4);
}

.lib-select option {
    background: #1a0e12;
}

.lib-btn {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(201,162,39,0.10);
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
    border-radius: var(--radius-sm);
    padding: 7px 16px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lib-btn:hover {
    background: rgba(201,162,39,0.18);
    color: var(--gold-light);
    text-decoration: none;
}

.lib-btn.lib-btn-back {
    background: rgba(139,26,26,0.12);
    border-color: rgba(139,26,26,0.35);
    color: var(--text-secondary);
}

.lib-btn.lib-btn-back:hover {
    background: rgba(139,26,26,0.22);
    color: var(--text-primary);
}

/* ── Pagination ── */
.lib-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--paper-border);
}

.lib-pagination .lib-pg-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.lib-pg-link {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--paper-border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.lib-pg-link:hover {
    color: var(--text-primary);
    border-color: rgba(201,162,39,0.25);
    text-decoration: none;
}

.lib-pg-link.active {
    background: rgba(201,162,39,0.10);
    border-color: var(--gold-border);
    color: var(--gold-light);
}

/* ── Data table ── */
.lib-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: transparent;
    border-radius: 0;
}

.lib-table th {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-dark);
    background: rgba(0,0,0,0.25);
    padding: 9px 12px;
    border-bottom: 1px solid var(--paper-border);
    border-top: none;
    text-align: left;
    white-space: nowrap;
    font-weight: 700;
}

.lib-table th a.lib-sort {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-decoration: none;
    margin-left: 4px;
}

.lib-table th a.lib-sort:hover,
.lib-table th a.lib-sort.active {
    color: var(--gold-primary);
}

.lib-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--paper-border);
    color: var(--text-primary);
    font-size: 0.875rem;
    vertical-align: middle;
}

.lib-table tr:last-child td { border-bottom: none; }

.lib-table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.015);
}

.lib-table tbody tr:hover {
    background: rgba(139,26,26,0.08);
    cursor: pointer;
}

.lib-table .lib-td-name a {
    color: var(--text-inverse);
    text-decoration: none;
    font-weight: 500;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.lib-table .lib-td-name a:hover {
    color: var(--gold-light);
}

.lib-table .lib-td-img {
    text-align: center;
    width: 72px;
    padding: 6px 12px;
}

.lib-table .lib-td-img img {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: auto;
}

.lib-table .lib-td-stat {
    text-align: right;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.lib-stat-hp  { color: #e07070; }
.lib-stat-exp { color: var(--gold-dark); }

/* ── Empty state ── */
.lib-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.lib-empty .lib-empty-icon {
    font-size: 2.2rem;
    color: var(--paper-border);
    margin-bottom: 12px;
    display: block;
}

.lib-empty p {
    font-size: 0.875rem;
    margin: 4px 0;
}

.lib-empty a { color: var(--gold-dark); }

/* ── NPC / Monster card grid ── */
.lib-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 16px 20px;
}

.lib-card {
    background: linear-gradient(160deg, #1a0e12 0%, #110810 100%);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    padding: 14px 10px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
    color: inherit;
}

.lib-card:hover {
    border-color: rgba(201,162,39,0.3);
    box-shadow: 0 2px 12px rgba(139,26,26,0.2);
    text-decoration: none;
    color: inherit;
}

.lib-card-sprite {
    width: 54px;
    height: 54px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

.lib-card-sprite-svg {
    width: 54px;
    height: 54px;
    opacity: 0.45;
    display: block;
    margin: auto;
}

.lib-card-name {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-inverse);
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.lib-card-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.lib-card-badge {
    font-size: 0.6rem;
    background: rgba(201,162,39,0.12);
    color: var(--gold-primary);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-full);
    padding: 1px 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ── Item category grid ── */
.lib-category-grid {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.lib-category-section h2 {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-dark);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lib-category-section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gold-border), transparent);
}

.lib-subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.lib-subcategory-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.lib-subcategory-card:hover {
    border-color: var(--gold-border);
    background: rgba(201,162,39,0.06);
    text-decoration: none;
}

.lib-subcategory-card img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
}

.lib-subcategory-name {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Items grid (search results / category items) ── */
.lib-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
    padding: 16px 20px;
}

.lib-item-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    padding: 10px 6px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: border-color 0.18s ease;
    text-decoration: none;
}

.lib-item-card:hover {
    border-color: var(--gold-border);
    text-decoration: none;
}

.lib-item-card img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
}

.lib-item-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.3;
    text-align: center;
}

.lib-item-detail-btn {
    font-size: 0.6rem;
    font-family: var(--font-heading);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(201,162,39,0.08);
    border: 1px solid var(--gold-border);
    color: var(--gold-dark);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    text-decoration: none;
    transition: background 0.18s ease;
    display: inline-block;
    margin-top: 2px;
}

.lib-item-detail-btn:hover {
    background: rgba(201,162,39,0.16);
    color: var(--gold-light);
    text-decoration: none;
}

/* ── Item / Monster detail panel ── */
.lib-detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--paper-border);
}

.lib-detail-sprite {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.lib-detail-title h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold-light);
    margin: 0 0 4px;
}

.lib-detail-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.lib-detail-body {
    padding: 16px 20px;
}

.lib-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--paper-border);
    font-size: 0.875rem;
}

.lib-detail-row:last-child { border-bottom: none; }

.lib-detail-key {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold-dark);
    min-width: 110px;
    flex-shrink: 0;
    padding-top: 1px;
}

.lib-detail-val {
    color: var(--text-primary);
}

/* Sub-section heading inside detail */
.lib-detail-section-title {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-dark);
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lib-detail-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gold-border), transparent);
}

/* Attack / loot items list */
.lib-attack-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lib-attack-list li {
    font-size: 0.82rem;
    color: var(--text-primary);
    padding: 4px 8px;
    background: rgba(0,0,0,0.2);
    border-left: 2px solid var(--red-dark);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.lib-loot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
}

.lib-loot-item {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm);
    padding: 6px 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.lib-loot-item img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.lib-loot-item span {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.lib-rarity-common { color: var(--text-secondary); font-size: 0.72rem; }
.lib-rarity-semirare { color: #5dbd7a; font-size: 0.72rem; }
.lib-rarity-rare { color: var(--gold-primary); font-size: 0.72rem; }

/* ── Spells tables ── */
.lib-spell-section {
    padding: 0 20px 20px;
}

.lib-spell-section-title {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-dark);
    padding: 14px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lib-spell-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gold-border), transparent);
}

/* ── Spells search/filter bar (custom dropdowns) ── */
.lib-spell-filter {
    padding: 14px 20px;
    border-bottom: 1px solid var(--paper-border);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.lib-spell-filter label {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.lib-spell-filter-field {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 130px;
}

.custom-dropdown-riv {
    background: #1a0e12 !important;
    border: 1px solid var(--gold-border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7) !important;
    overflow: hidden;
}

.custom-dropdown-riv div {
    padding: 8px 12px !important;
    font-family: var(--font-body) !important;
    font-size: 0.85rem !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--paper-border);
    cursor: pointer;
}

.custom-dropdown-riv div:last-child { border-bottom: none; }

.custom-dropdown-riv div:hover {
    background: rgba(201,162,39,0.08) !important;
    color: var(--gold-light) !important;
}

/* ── Attribute table inside detail ── */
.lib-attr-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    margin-top: 8px;
}

.lib-attr-table tr:nth-child(odd) td { background: rgba(0,0,0,0.15); }

.lib-attr-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--paper-border);
    font-size: 0.82rem;
}

.lib-attr-table td:first-child {
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: capitalize;
    width: 40%;
}

.lib-attr-table td:last-child {
    color: var(--text-primary);
}

/* ── Map page ── */
.lib-map-controls {
    padding: 12px 20px;
    border-bottom: 1px solid var(--paper-border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.lib-map-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lib-map-control-group label {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.lib-map-input {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--paper-border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    width: 70px;
    transition: border-color 0.18s ease;
}

.lib-map-input:focus {
    outline: none;
    border-color: rgba(201,162,39,0.4);
}

.lib-map-btn {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(201,162,39,0.10);
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.18s ease;
    white-space: nowrap;
}

.lib-map-btn:hover {
    background: rgba(201,162,39,0.20);
    color: var(--gold-light);
}

.lib-map-btn.lib-map-btn-zoom {
    padding: 5px 10px;
    font-size: 0.9rem;
    font-family: var(--font-mono);
}

.lib-map-btn.lib-map-btn-reset {
    background: rgba(139,26,26,0.12);
    border-color: rgba(139,26,26,0.35);
    color: var(--text-secondary);
}

.lib-map-btn.lib-map-btn-reset:hover {
    background: rgba(139,26,26,0.22);
    color: var(--text-primary);
}

.lib-map-zoom-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 44px;
    text-align: center;
}

.lib-map-view {
    background: #0a0608;
    border: none;
    position: relative;
    overflow: hidden;
    height: 640px;
    cursor: grab;
}

.lib-map-view:active {
    cursor: grabbing;
}

/* ── NPC detail trade ── */
.lib-trade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 20px;
}

@media (max-width: 600px) {
    .lib-trade-grid { grid-template-columns: 1fr; }
}

.lib-trade-col {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.lib-trade-col-head {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-dark);
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--paper-border);
}

/* ── Admin cache bar ── */
.lib-admin-bar {
    padding: 10px 20px;
    background: rgba(201,162,39,0.05);
    border-bottom: 1px solid var(--gold-border);
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* ── Responsive ── */
@media (max-width: 560px) {
    .lib-card-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); padding: 10px; }
    .lib-filter-bar { padding: 10px 12px; }
    .lib-page-header { padding: 14px 12px 10px; }
    .lib-trade-grid { grid-template-columns: 1fr; }
    .lib-map-controls { padding: 10px 12px; gap: 10px; }
    .lib-map-view { height: 420px; }
}

/* ── Live search hidden rows ── */
.lib-row-hidden {
    display: none !important;
}

/* ── Highscores ── */
.lib-rank-circle {
    background: rgba(201,162,39,.1);
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: .75rem;
}

.lib-voc-badge {
    background: rgba(201,162,39,.08);
    color: var(--gold-dark);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-family: var(--font-heading);
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    white-space: nowrap;
}

/* ── News page ── */
.lib-news-item {
    background: linear-gradient(160deg,#1a0e12 0%,#110810 100%);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    margin-bottom: 12px; overflow: hidden;
    transition: border-color .18s;
}
.lib-news-item:hover { border-color: rgba(201,162,39,.25); }

.lib-news-title-bar {
    background: rgba(0,0,0,.3);
    border-bottom: 1px solid var(--paper-border);
    padding: 8px 14px;
    font-family: var(--font-heading); font-size: .78rem;
    letter-spacing: .03em; color: var(--text-muted);
}
.lib-news-title-bar a { color: var(--gold-primary); text-decoration: none; }
.lib-news-title-bar a:hover { color: var(--gold-light); }
.lib-news-title-bar b { color: var(--text-primary); }

.lib-news-body {
    padding: 14px 16px;
    color: var(--text-primary); font-size: .9rem; line-height: 1.75;
}
.lib-news-body img {
    max-width: 100%; height: auto;
    border-radius: var(--radius-sm);
    cursor: pointer; border: 1px solid var(--paper-border);
    display: block; margin: 8px 0;
}
.lib-news-body a { color: var(--gold-primary); }
.lib-news-body a:hover { color: var(--gold-light); }
.lib-news-body center { text-align: center; }

.lib-changelog { padding: 4px 0 16px; }
.lib-changelog h2 {
    font-family: var(--font-heading); font-size: .78rem;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dark); margin: 0 0 10px;
    display: flex; align-items: center; gap: 8px;
}
.lib-changelog h2::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(to right,var(--gold-border),transparent);
}

.lib-img-modal {
    display: none; position: fixed; z-index: 9999; inset: 0;
    background: rgba(0,0,0,.92); cursor: pointer;
}
.lib-img-modal.open { display: block; }
.lib-img-modal img {
    max-width: 90%; max-height: 90%;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    border-radius: var(--radius-sm);
}
.lib-img-modal-close {
    position: absolute; top: 18px; right: 26px;
    color: #fff; font-size: 2rem; cursor: pointer;
    font-weight: 700; line-height: 1;
}
.lib-img-modal-close:hover { color: var(--gold-primary); }

/* ── Guilds page ── */
.guild-container { padding: 4px 0; }

.guild-controls {
    background: rgba(0,0,0,.2);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    padding: 14px 16px; margin-bottom: 16px;
}

.guild-search-filter {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin-bottom: 10px;
}
.guild-search-filter .filter-group {
    display: flex; flex-direction: column; flex: 1; min-width: 140px;
}
.guild-search-filter .filter-group label {
    font-family: var(--font-heading); font-size: .65rem;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 4px; display: block;
}
.guild-search-filter .filter-group input,
.guild-search-filter .filter-group select {
    background: rgba(0,0,0,.35); border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    padding: 6px 10px; font-size: .85rem; transition: border-color .18s;
}
.guild-search-filter .filter-group input:focus,
.guild-search-filter .filter-group select:focus {
    outline: none; border-color: var(--gold-border);
}

.guild-count { font-size: .78rem; color: var(--text-muted); text-align: right; }

.guild-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px; margin-bottom: 24px;
}

.guild-card {
    background: linear-gradient(160deg,#1a0e12 0%,#110810 100%);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    padding: 16px; display: flex; flex-direction: column;
    min-height: 200px; cursor: pointer;
    transition: border-color .18s, box-shadow .18s;
}
.guild-card:hover {
    border-color: rgba(201,162,39,.3);
    box-shadow: 0 4px 20px rgba(139,26,26,.25);
}
.guild-card.hidden { display: none; }

.guild-card-logo { text-align: center; margin-bottom: 12px; }
.guild-card-logo img {
    max-width: 80px; max-height: 80px;
    border: 1px solid var(--gold-border); border-radius: var(--radius-sm);
}

.guild-card-content { flex: 1; display: flex; flex-direction: column; }

h2.guild-card-title {
    font-family: var(--font-heading); font-size: .95rem; font-weight: 700;
    color: var(--gold-light); margin: 0 0 8px; text-align: left;
}

.guild-card-description {
    color: var(--text-muted); font-size: .82rem; line-height: 1.5;
    margin-bottom: 12px; flex: 1;
}
.guild-card-description-full { display: none; }
.guild-card-readmore { color: var(--gold-dark); font-size: .78rem; cursor: pointer; }
.guild-card-readmore:hover { color: var(--gold-primary); }

.guild-card-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    margin-top: auto; padding-top: 12px;
    border-top: 1px solid var(--paper-border);
}
.stat-item { display: flex; justify-content: space-between; align-items: center; }
.stat-label { color: var(--text-muted); font-size: .78rem; }
.stat-value { color: var(--gold-primary); font-weight: 700; font-size: .85rem; }

.guild-back-button { margin: 12px 0 8px; }
.back-to-guilds-btn {
    display: inline-block; padding: 6px 16px;
    background: rgba(201,162,39,.1); border: 1px solid var(--gold-border);
    color: var(--gold-primary); border-radius: var(--radius-sm);
    font-family: var(--font-heading); font-size: .72rem;
    letter-spacing: .06em; text-transform: uppercase;
    text-decoration: none; transition: background .18s;
}
.back-to-guilds-btn:hover {
    background: rgba(201,162,39,.2); color: var(--gold-light); text-decoration: none;
}

#guildTitleDiv {
    background: rgba(0,0,0,.2); border: 1px solid var(--paper-border);
    border-radius: var(--radius-md); padding: 20px; margin: 12px 0;
    display: flex; align-items: center; gap: 16px;
}
#guildImageDiv img { border: 1px solid var(--gold-border); border-radius: var(--radius-sm); }
#guildDescription h1 {
    font-family: var(--font-heading); font-size: 1.4rem;
    color: var(--gold-light); margin: 0 0 6px;
}
#guildDescription p {
    color: var(--text-muted); font-size: .9rem; line-height: 1.5; margin: 0 0 10px;
}
.guild-stats-info {
    display: flex; flex-wrap: wrap; gap: 16px;
    padding-top: 10px; border-top: 1px solid var(--paper-border); margin-top: 10px;
}
.guild-stat-item { font-size: .82rem; color: var(--text-secondary); }
.guild-stat-item::before { content: "• "; color: var(--gold-dark); }

.guild-war-banner {
    background: linear-gradient(90deg,#3a0000,#7a0000,#b30000);
    color: #fff; padding: 14px; margin-bottom: 16px;
    border-radius: var(--radius-sm); text-align: center;
    font-size: .9rem; font-weight: 700; line-height: 1.5;
    animation: warPulse 1.5s infinite alternate;
}
.guild-war-banner a { color: #fff !important; text-decoration: underline; }
@keyframes warPulse {
    from { box-shadow: 0 0 8px #f00; }
    to   { box-shadow: 0 0 20px #f44; }
}

.guilds-header {
    text-align: center; margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--paper-border);
}
.guilds-header h1 {
    font-family: var(--font-display); font-size: 1.8rem;
    color: var(--gold-light); text-transform: uppercase;
    letter-spacing: .15em; margin-bottom: 6px;
}
.guilds-header p { color: var(--text-muted); font-size: .9rem; margin: 0; padding: 0; text-align: center; }

.guild-container form {
    background: rgba(0,0,0,.2); border: 1px solid var(--paper-border);
    border-radius: var(--radius-md); padding: 16px; margin: 12px 0;
}
.guild-container form ul { list-style: none; padding: 0; margin: 0; }
.guild-container form li { margin: 12px 0; }
.guild-container form label {
    color: var(--text-muted); font-family: var(--font-heading);
    font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
    display: block; margin-bottom: 4px;
}
.guild-container form input[type="text"],
.guild-container form input[type="number"],
.guild-container form input[type="file"],
.guild-container form textarea,
.guild-container form select {
    background: rgba(0,0,0,.35) !important; border: 1px solid var(--paper-border) !important;
    border-radius: var(--radius-sm) !important; color: var(--text-primary) !important;
    padding: 7px 10px; font-size: .85rem; max-width: 320px;
    box-shadow: none !important; font-weight: normal !important; transform: none !important;
    transition: border-color .18s;
}
.guild-container form input[type="text"]:focus,
.guild-container form input[type="number"]:focus,
.guild-container form select:focus,
.guild-container form textarea:focus {
    outline: none; border-color: var(--gold-border) !important;
    box-shadow: none !important; transform: none !important;
    background: rgba(0,0,0,.35) !important;
}
.guild-container form input[type="submit"],
.guild-container form button {
    background: rgba(201,162,39,.12) !important; border: 1px solid var(--gold-border) !important;
    color: var(--gold-primary) !important; border-radius: var(--radius-sm) !important;
    font-family: var(--font-heading) !important; font-size: .7rem !important;
    letter-spacing: .06em !important; text-transform: uppercase !important;
    cursor: pointer; padding: 7px 16px !important; margin: 6px 4px !important;
    transform: none !important; box-shadow: none !important; transition: background .18s !important;
}
.guild-container form input[type="submit"]:hover,
.guild-container form button:hover {
    background: rgba(201,162,39,.22) !important; color: var(--gold-light) !important;
    transform: none !important;
}

.create-guild-form-top { margin-bottom: 24px; }
.create-guild-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.create-guild-field { display: flex; flex-direction: column; flex: 1; min-width: 140px; }
.create-guild-field label {
    font-family: var(--font-heading); font-size: .65rem; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; display: block;
    height: auto; line-height: normal; flex-shrink: 0;
}
.create-guild-field input[type="submit"],
.create-guild-form-top input[type="submit"] {
    transform: none !important; margin: 0 !important;
}
.create-guild-field input[type="submit"]:hover,
.create-guild-form-top input[type="submit"]:hover { transform: none !important; }

.login-notice {
    background: rgba(0,0,0,.2); border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm); padding: 14px;
    color: var(--text-muted); font-size: .875rem; text-align: center; margin-bottom: 20px;
}
.login-notice a { color: var(--gold-primary); }

.error-message {
    background: rgba(139,26,26,.15); border: 1px solid rgba(139,26,26,.35);
    border-radius: var(--radius-sm); padding: 10px 14px;
    color: #f08080; font-size: .875rem; margin: 8px 0;
}

/* ── Forum page ── */
.lib-forum-table { width: 100%; border-collapse: collapse; margin: 0; }
.lib-forum-table th {
    font-family: var(--font-heading); font-size: .68rem;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dark); padding: 8px 14px;
    border-bottom: 2px solid var(--gold-border);
    background: rgba(0,0,0,.25); font-weight: 700; text-align: left;
}
.lib-forum-table td {
    padding: 10px 14px; border-bottom: 1px solid var(--paper-border);
    font-size: .875rem; color: var(--text-primary); vertical-align: middle;
}
.lib-forum-table tr.special { cursor: pointer; transition: background .18s; }
.lib-forum-table tr.special:hover td {
    background: rgba(201,162,39,.04); color: var(--gold-light);
}

.lib-forum-link-map {
    font-size: .78rem; color: var(--text-muted); margin-bottom: 8px; display: block;
}
.lib-forum-link-map a { color: var(--gold-primary); text-decoration: none; }

.lib-forum-cooldown { color: #f08080; font-size: .82rem; display: block; margin: 8px 0; }

.lib-thread-block {
    background: linear-gradient(160deg,#1a0e12 0%,#110810 100%);
    border: 1px solid var(--paper-border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 12px;
}
.lib-thread-header {
    background: rgba(0,0,0,.3); border-bottom: 1px solid var(--paper-border);
    padding: 7px 14px; font-family: var(--font-heading); font-size: .72rem;
    color: var(--text-muted); letter-spacing: .04em;
}
.lib-thread-header a { color: var(--gold-primary); text-decoration: none; }
.lib-thread-body { display: flex; }
.lib-thread-avatar {
    width: 90px; flex-shrink: 0; padding: 12px 10px;
    border-right: 1px solid var(--paper-border);
    text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.lib-thread-avatar a { color: var(--gold-primary); font-size: .78rem; font-weight: 600; text-decoration: none; }
.lib-thread-avatar img { margin-top: 4px; }
.lib-thread-avatar span { font-size: .68rem; color: var(--text-muted); }
.lib-thread-content { flex: 1; padding: 12px 14px; font-size: .875rem; color: var(--text-primary); line-height: 1.6; }
.lib-thread-content p { margin: 0; }

.lib-forum-section-title {
    font-family: var(--font-heading); font-size: .78rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dark);
    margin: 18px 0 8px; display: flex; align-items: center; gap: 8px;
}
.lib-forum-section-title::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(to right, var(--gold-border), transparent);
}

.lib-forum-form {
    background: rgba(0,0,0,.2); border: 1px solid var(--paper-border);
    border-radius: var(--radius-md); padding: 14px 16px; margin: 12px 0;
}
.lib-forum-form p {
    font-size: .75rem; color: var(--text-muted); margin: 0 0 8px; line-height: 1.5;
}
.lib-forum-form p a { color: var(--gold-primary); }
.lib-forum-form textarea {
    width: 100%; background: rgba(0,0,0,.35);
    border: 1px solid var(--paper-border); border-radius: var(--radius-sm);
    color: var(--text-primary); padding: 8px 10px; font-size: .875rem;
    min-height: 120px; resize: vertical; box-sizing: border-box;
}
.lib-forum-form textarea:focus { outline: none; border-color: var(--gold-border); }
.lib-forum-form input[type="text"],
.lib-forum-form input[disabled] {
    background: rgba(0,0,0,.35) !important; border: 1px solid var(--paper-border) !important;
    border-radius: var(--radius-sm) !important; color: var(--text-primary) !important;
    padding: 7px 10px; font-size: .875rem;
}
.lib-forum-form input[type="text"]:focus { outline: none; border-color: var(--gold-border); }
.lib-forum-form select {
    background: rgba(0,0,0,.35); border: 1px solid var(--paper-border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    padding: 7px 10px; font-size: .875rem;
}
.lib-forum-admin-row {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}

/* Button danger/warning variants */
.lib-btn-danger {
    background: rgba(139,26,26,.15);
    border-color: rgba(139,26,26,.4);
    color: #f08080;
}
.lib-btn-danger:hover { background: rgba(139,26,26,.25); color: #ff9999; }
.lib-btn-warning {
    background: rgba(201,162,39,.12);
    border-color: var(--gold-border);
    color: var(--gold-primary);
}
.lib-btn-warning:hover { background: rgba(201,162,39,.22); color: var(--gold-light); }

/* Deaths / Online unjustified tag */
.unjustified-tag { color: #f08080; font-size: .78rem; font-weight: 600; }

/* Online list level coloring helpers */
.lib-level-high { color: var(--gold-primary) !important; font-weight: 700; }
.lib-level-mid  { color: #7cba8a !important; font-weight: 600; }
.lib-level-low  { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════
   HIGHSCORES — high-contrast refinement (scoped to .hs-wrap)
   Overrides the muted shared palette only on highscores.php so
   ranks, names and stats read clearly against the near-black bg.
   ═══════════════════════════════════════════════════════════════ */
.hs-wrap {
    background: linear-gradient(180deg, rgba(28,16,18,0.55) 0%, rgba(12,7,8,0.35) 100%);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0,0,0,0.45);
}

/* Header strip — brighter title + accent underline */
.hs-wrap .lib-page-header {
    background: rgba(0,0,0,0.30);
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--gold-border);
}
.hs-wrap .lib-page-header h1 {
    color: #e4be8b;
    font-size: 1.18rem;
    text-shadow: 0 1px 10px rgba(183,139,81,0.35);
}
.hs-wrap .lib-page-header h1 .fa { color: var(--gold-light); }
.hs-wrap .lib-count-badge {
    color: #e4be8b;
    background: rgba(183,139,81,0.18);
    border-color: var(--gold-border);
    font-size: 0.72rem;
}

/* Filter bar — clearer labels and inputs */
.hs-wrap .lib-filter-bar { background: rgba(0,0,0,0.18); padding: 14px 22px; }
.hs-wrap .lib-map-control-group label {
    color: #b9b0b2;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.62rem;
    font-weight: 700;
}
.hs-wrap .lib-select {
    background: rgba(0,0,0,0.55);
    border-color: rgba(255,255,255,0.14);
    color: #f1ecec;
    font-weight: 600;
}
.hs-wrap .lib-select:hover { border-color: var(--gold-border); }
.hs-wrap .lib-btn {
    background: linear-gradient(180deg, var(--gold-primary), var(--gold-dark));
    border-color: var(--gold-dark);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(183,139,81,0.35);
}
.hs-wrap .lib-btn:hover {
    background: linear-gradient(180deg, var(--gold-light), var(--gold-primary));
    color: #fff;
}

/* Table — stronger header, visible zebra + hover */
.hs-wrap .lib-table th {
    color: #e4be8b;
    background: rgba(0,0,0,0.45);
    border-bottom: 1px solid var(--gold-border);
    font-size: 0.66rem;
}
.hs-wrap .lib-table tbody tr:nth-child(odd)  { background: rgba(255,255,255,0.022); }
.hs-wrap .lib-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.006); }
.hs-wrap .lib-table td { border-bottom: 1px solid rgba(255,255,255,0.05); }
.hs-wrap .lib-table tbody tr:hover {
    background: rgba(183,139,81,0.14);
    box-shadow: inset 3px 0 0 0 var(--gold-primary);
}

/* Player names — high contrast, gold on hover */
.hs-wrap .lib-table .lib-td-name a {
    color: #f4eef0;
    font-size: 0.88rem;
    font-weight: 600;
}
.hs-wrap .lib-table .lib-td-name a:hover { color: var(--gold-light); }

/* Vocation badge — readable accent */
.hs-wrap .lib-voc-badge {
    color: #e4be8b;
    background: rgba(183,139,81,0.16);
    border-color: var(--gold-border);
}

/* Stat values — bright, prominent */
.hs-wrap .lib-td-stat {
    color: #ece3e4;
    font-size: 0.9rem;
    font-weight: 600;
}
.hs-wrap .lib-stat-exp { color: var(--gold-light); }

/* Pagination caption */
.hs-wrap > div[style] { color: #b3aaac !important; }

/* Rank circles — clearer default, medals for the top 3 */
.hs-wrap .lib-rank-circle {
    width: 30px; height: 30px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
    color: #e7dede;
    font-size: 0.8rem;
}
.hs-wrap .lib-rank-medal { color: #1a0e10; border: none; font-weight: 800; }
.hs-wrap .lib-rank-1 {
    background: linear-gradient(145deg, #ffe487, #d9a216);
    box-shadow: 0 0 14px rgba(217,162,22,0.55);
}
.hs-wrap .lib-rank-2 {
    background: linear-gradient(145deg, #eef2f6, #b9c2cc);
    box-shadow: 0 0 12px rgba(200,210,220,0.40);
}
.hs-wrap .lib-rank-3 {
    background: linear-gradient(145deg, #f0b083, #c47535);
    box-shadow: 0 0 12px rgba(196,117,53,0.45);
}
.hs-wrap .hs-top .lib-td-name a { font-weight: 700; }
.hs-wrap .hs-top-1 .lib-td-name a { color: #ffe487; }

/* Empty state */
.hs-wrap .lib-empty { color: #b3aaac; }

/* ==========================================================================
   Wiki browse tiles - shared by wiki.php and the items.php category browser
   ========================================================================== */
/* ── Intro strip ── */
.wk-intro {
    padding: 15px 20px;
    border-bottom: 1px solid var(--paper-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.wk-intro p {
    margin: 0; max-width: 68ch;
    font-size: 0.92rem; line-height: 1.6; color: var(--text-muted);
}
.wk-intro-link {
    font-family: var(--font-heading); font-size: 0.78rem;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--gold-light); text-decoration: none; white-space: nowrap;
    border: 1px solid var(--gold-border); border-radius: var(--radius-sm);
    padding: 7px 13px; transition: background 0.18s ease;
}
.wk-intro-link:hover { background: rgba(201,162,39,0.10); text-decoration: none; }

/* ── Breadcrumb + blurb on a category page ── */
.wk-breadcrumb {
    padding: 13px 20px 0;
    font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.wk-breadcrumb a { color: var(--gold-dark); text-decoration: none; }
.wk-breadcrumb a:hover { color: var(--gold-light); }
.wk-breadcrumb .fa { opacity: 0.5; }

.wk-blurb {
    padding: 8px 20px 0; margin: 0; max-width: 76ch;
    font-size: 0.9rem; line-height: 1.6; color: var(--text-muted);
}

/* ── Section + group headings ── */
.wk-section-title, .wk-group-title {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-heading); font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-dark);
    margin: 6px 0 0; padding: 22px 20px 0;
    border-top: 1px solid var(--paper-border);
}
.wk-section-title { font-size: 0.9rem; }
/* The first section sits under the intro's own bottom border, so no second line. */
.wk-section-title--first { border-top: none; padding-top: 16px; }
.wk-group-title   { font-size: 0.82rem; border-top: none; padding-top: 16px; }
.wk-section-title::after, .wk-group-title::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(to right, var(--gold-border), transparent);
}
.wk-section-n {
    font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted);
    border: 1px solid var(--paper-border); border-radius: var(--radius-full); padding: 1px 8px;
}

/* ── Tile grid ──
   Fixed art box + fixed meta line means every tile is exactly the same
   height, whatever the label length or whether a count is known. */
.wk-grid {
    padding: 16px 20px 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.wk-grid:last-of-type { padding-bottom: 24px; }
.wk-grid-top { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }

.wk-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    padding: 16px 10px 13px;
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(0,0,0,0.28));
    border: 1px solid var(--paper-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.wk-tile::before {
    content: '';
    position: absolute; inset: 0 0 auto 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
    opacity: 0; transition: opacity 0.18s ease;
}
.wk-tile:hover {
    border-color: var(--gold-border);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    text-decoration: none;
}
.wk-tile:hover::before { opacity: 1; }

.wk-tile-art {
    height: 60px; width: 100%;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
}
.wk-tile-art img {
    max-width: 48px; max-height: 52px;
    object-fit: contain; image-rendering: pixelated;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.7));
    transition: transform 0.18s ease;
}
.wk-tile:hover .wk-tile-art img { transform: scale(1.12); }
.wk-tile-fallback { font-size: 26px; color: var(--text-muted); opacity: 0.35; }

.wk-tile-name {
    font-family: var(--font-heading);
    font-size: 0.86rem; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--gold-light); text-align: center; line-height: 1.3;
    /* Always reserve two lines so a one-word tile is exactly as tall as a
       two-word one, in every row of the grid. */
    min-height: 2.6em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wk-tile:hover .wk-tile-name { color: var(--gold-primary); }

.wk-tile-meta {
    margin-top: 5px;
    font-family: var(--font-mono); font-size: 0.68rem;
    color: var(--text-muted); text-align: center; line-height: 1.2;
}

@media (max-width: 560px) {
    .wk-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); padding: 14px; gap: 9px; }
    .wk-grid-top { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .wk-intro { flex-direction: column; align-items: flex-start; }
    .wk-section-title, .wk-group-title { padding-left: 14px; padding-right: 14px; }
    .wk-tile-art { height: 50px; }
    .wk-tile-art img { max-width: 40px; max-height: 44px; }
}
