.navlink { padding: 5px 10px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.navlink.active, .navlink:hover { color: var(--accent); }
main.wiki { max-width: 1180px; }
.muted { color: var(--muted); }

.searchwrap { position: relative; }
#q { width: 100%; padding: 13px 16px; font-size: 17px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); }
#q:focus { outline: none; border-color: var(--accent); }
.dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-height: 60vh; overflow-y: auto; }
.dropdown button { display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: left; padding: 10px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.dropdown button:last-child { border-bottom: 0; }
.dropdown button.sel, .dropdown button:hover { background: var(--current); }
.dropdown .dn { font-weight: 600; }
.dropdown .da { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spoiler { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 14px; }
.spoiler input[type=number] { width: 84px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.switch { margin-left: auto; display: flex; align-items: center; gap: 6px; cursor: pointer; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.rel { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.rel.friend { background: #dcefdc; color: #22622a; }
.rel.foe { background: #f6dcd8; color: #9a2a1c; }
.rel.love { background: #f7dcea; color: #9a2463; }
.rel.family, .rel.master { background: #e3e0f5; color: #4b3a99; }
.rel.neutral { background: var(--line); color: var(--muted); }
.rel.mixed { background: #f5ead2; color: #86600f; }
:root[data-theme="dark"] .rel.friend { background: #1f3a22; color: #9fd8a5; }
:root[data-theme="dark"] .rel.foe { background: #47221d; color: #f0a497; }
:root[data-theme="dark"] .rel.love { background: #46213a; color: #f2a5cf; }
:root[data-theme="dark"] .rel.family, :root[data-theme="dark"] .rel.master { background: #2d2850; color: #bdb2f3; }
:root[data-theme="dark"] .rel.mixed { background: #43361a; color: #e8c97a; }

/* detail card */
#card { margin: 16px 0 8px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 16px 18px; }
#card .top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#card h2 { margin: 0; font-size: 1.45rem; }
#card .close { margin-left: auto; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
#card .aka { color: var(--muted); margin: 4px 0 10px; font-size: 14px; }
#card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; }
#card dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
#card dd { margin: 0; }
#card .hist { color: var(--muted); font-size: 12.5px; }
#card .notes { margin: 10px 0 0; padding-left: 18px; }
#card .notes li { margin-bottom: 5px; }
#card .notes .c { color: var(--muted); font-size: 12px; margin-right: 6px; }
#card .meta { margin-top: 10px; font-size: 13px; color: var(--muted); }
#card .meta a { color: var(--accent); }
#card .hidden-note { color: var(--muted); font-style: italic; font-size: 13px; }

/* tabs + tables */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { font-weight: 400; font-size: 12px; margin-left: 4px; }
.tablebar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
#filter { flex: 1; max-width: 360px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; cursor: pointer; white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--current); }
td.name { font-weight: 600; min-width: 140px; }
td.ch { color: var(--muted); white-space: nowrap; }
td.use { min-width: 220px; }
tr.locked td { color: var(--muted); }

@media (max-width: 640px) {
  .switch { margin-left: 0; }
  #card dl { grid-template-columns: 1fr; gap: 0; }
  #card dd { margin-bottom: 8px; }
}
