:root {
  --bg: #fff;
  --ink: #000;
  --muted: #444;
  --line: #767676;
  --mark: #00478a;
  --face: #f0f0f0;
  --hover: #e5f3ff;
  --found: #fff0a0;
  --yes: #1a7f37;
  --no: #c62828;
  --shade: rgb(0 0 0 / 0.6);
  --target: 44px;
  --pad: 16px;
  --ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --ink: #fff;
    --muted: #c9ced4;
    --line: #8f969e;
    --mark: #9ccaff;
    --face: #23282e;
    --hover: #233243;
    --found: #3d3400;
    --yes: #2ea043;
    --no: #e5534b;
    --shade: rgb(0 0 0 / 0.75);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--bg); }
body {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; margin: 0; padding: var(--pad); background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--ui);
}
a { color: var(--mark); }
p, h1, h2 { max-width: 80ch; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.top { display: flex; flex: none; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
h1 { flex: 1 1 auto; align-self: center; min-width: 0; margin: 0; font-size: 1rem; line-height: 1.5; }
.tool.icon { display: inline-flex; flex: none; align-items: center; justify-content: center; margin-left: auto; padding: 0; font-size: 1.5rem; line-height: 1; }
.language { display: contents; }
#languageLabel { grid-area: 2 / 1; align-self: center; }
.language-button { display: inline-flex; grid-area: 2 / 2; justify-self: start; align-items: center; gap: 12px; }
.language-button::after {
  content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-25%) rotate(45deg);
}
.language-button[aria-expanded="true"]::after { transform: translateY(25%) rotate(-135deg); }
.language-list {
  display: grid; grid-area: 3 / 1 / 4 / 3; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); align-content: start; gap: 4px;
  min-height: 0; margin: 0; padding: 8px; overflow-y: auto; list-style: none; border: 1px solid var(--line); border-radius: 4px; background: var(--bg);
}
.language-option { width: 100%; text-align: left; }
.language-option[aria-current="true"] { border-color: var(--mark); box-shadow: inset 4px 0 0 var(--mark); font-weight: 700; }
.load-error { flex: none; margin: 0 0 12px; }

.content { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.panes { display: flex; flex: 1; flex-direction: column; gap: 12px; min-height: 0; }
.pane:first-child { flex: 0 1 auto; }
.pane:last-child { flex: 1 0 10rem; }
@media (min-width: 720px) {
  .panes { display: grid; grid-template-columns: minmax(20rem, 2fr) minmax(16rem, 3fr); grid-template-rows: minmax(0, 1fr); gap: 16px; }
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--line); }
.pane-head {
  display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--face);
}
.pane-head h2 { margin: 0 auto 0 0; font-size: 1.125rem; line-height: 1.25; }
.pane-head p { margin: 0; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool {
  min-width: var(--target); min-height: var(--target); padding: 8px 14px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg); color: var(--ink); font: inherit; line-height: 1.25; cursor: pointer;
}
.tool:hover { background: var(--hover); border-color: var(--mark); }
.find { display: flex; flex-basis: 100%; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.find input {
  flex: 1 1 10rem; min-width: var(--target); height: var(--target); padding: 0 8px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg); color: var(--ink); font: inherit;
}
.legend { display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 4px 16px; }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.scroll { position: relative; flex: 1; min-height: 0; padding: 8px; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 8px; }
.scroll:focus-visible { outline-offset: -3px; }

.tree, .tree ul { margin: 0; padding: 0; list-style: none; }
.tree ul { margin-left: calc(var(--target) / 2); border-left: 1px dotted var(--line); }
.row { display: flex; align-items: center; min-height: var(--target); }
.twisty, .gap { position: relative; flex: none; width: var(--target); height: var(--target); }
.twisty { padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ink); cursor: pointer; }
.twisty:hover { background: var(--hover); }
.twisty::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translate(-75%, -50%) rotate(-45deg);
}
.twisty[aria-expanded="true"]::before { transform: translate(-50%, -75%) rotate(45deg); }
.node {
  display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; min-height: var(--target); padding: 0 8px; border-radius: 4px;
  cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.node:is(:hover, .pressed) { background: var(--hover); }
.node.found { background: var(--found); box-shadow: inset 4px 0 0 var(--mark); }
.node .name { min-width: 0; overflow-wrap: anywhere; }
.box { position: relative; flex: none; width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 3px; background: var(--bg); }
.box::before, .box::after { content: ""; position: absolute; left: 50%; top: 50%; }
[data-state="has"] > .box { border-color: var(--yes); background: var(--yes); }
[data-state="lacks"] > .box { border-color: var(--no); background: var(--no); }
[data-state="mixed"] > .box { border-color: var(--ink); }
[data-state="has"] > .box::after {
  width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translate(-50%, -60%) rotate(45deg);
}
[data-state="lacks"] > .box::before, [data-state="lacks"] > .box::after {
  width: 0; height: 13px; border-left: 2.5px solid #fff; transform: translate(-50%, -50%) rotate(45deg);
}
[data-state="lacks"] > .box::after { transform: translate(-50%, -50%) rotate(-45deg); }
[data-state="mixed"] > .box::after { width: 10px; height: 0; border-top: 2.5px solid var(--ink); transform: translate(-50%, -50%); }
@media (forced-colors: active) {
  .box { forced-color-adjust: none; border-color: CanvasText; background: Canvas; }
  :is([data-state="has"], [data-state="lacks"]) > .box { border-color: Highlight; background: Highlight; }
  [data-state] > .box::before, [data-state] > .box::after { border-color: HighlightText; }
  [data-state="mixed"] > .box::after { border-color: CanvasText; }
}
.tree > li > .row .name, .node:is(.group, .self) .name { font-weight: 700; }
.node .n { margin-left: auto; padding-left: 8px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
:is(.twisty, .node):focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.ticked {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; padding: 4px 4px 12px; border-bottom: 1px solid var(--line);
}
.ticked ul { display: contents; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--target); padding: 6px 14px; border: 1px solid var(--mark);
  border-radius: 22px; background: var(--hover); color: var(--ink); font: inherit; line-height: 1.25; text-align: left; cursor: pointer;
}
.chip:hover { border-width: 2px; padding: 5px 13px; }
.civs { margin: 0; padding: 4px; list-style: none; columns: 11rem; column-gap: 16px; }
.civs li { padding: 2px 0; break-inside: avoid; }
.none { margin: 0; padding: 4px; }
.foot { flex: none; }
.foot p { margin: 8px 0 0; color: var(--muted); }

dialog {
  width: min(48rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 16px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 4px; background: var(--bg); color: var(--ink);
}
dialog::backdrop { background: var(--shade); }
dialog h2 { margin: 0 0 8px; font-size: 1.125rem; }
dialog p { margin: 8px 0; }
.options { width: min(32rem, calc(100vw - 32px)); }
.options[open] {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 8px 12px;
  height: min(30rem, calc(100vh - 32px)); height: min(30rem, calc(100dvh - 32px));
}
.options h2, .options form { grid-column: 1 / 3; margin: 0; }
.settings { grid-area: 3 / 1 / 4 / 3; min-height: 0; overflow-y: auto; }
.settings p { margin: 8px 0 0; }
.option {
  display: flex; align-items: center; gap: 10px; min-height: var(--target); padding: 0 8px; border-radius: 4px; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.option:hover { background: var(--hover); }
.report-list { margin: 8px 0; padding-left: 1.5em; overflow-wrap: anywhere; }
.downloads a { display: inline-flex; align-items: center; min-height: var(--target); }

@media (max-height: 499px), (max-width: 719px) and (max-height: 639px) {
  .content { display: block; overflow-y: auto; }
  .panes { display: block; }
  .pane { min-height: auto; }
  .pane + .pane { margin-top: 12px; }
  .scroll { flex: none; overflow: visible; }
}
@media (max-width: 400px) {
  :root { --pad: 8px; }
  .scroll { padding: 4px; }
  .tree ul { margin-left: 12px; }
}

.test-frame { position: fixed; z-index: 2; top: 0; left: 0; border: 0; background: var(--bg); }
.test-frame.small { width: 320px; height: 256px; }
.test-frame.phone { width: 360px; height: 640px; }
.test-frame.tall { width: 390px; height: 844px; }
.text-spacing-test * { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; }
.text-spacing-test p { margin-bottom: 2em !important; }
