/* Remote control. The game's navy and ink, its display face for headings, lime for two things only:
   the primary action and whatever is live. Amber marks "differs from built-in", sky marks "not published". */

@font-face {
  font-family: "Protest Strike";
  src: url("fonts/ProtestStrike-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: rgb(12 18 30);
  --navy: rgb(18 44 86);
  --panel: #0f2447;     /* blocks on the page, between ink and navy */
  --raise: #1b3b70;     /* hover, chips */
  --line: #2c4a7c;      /* dividers */
  --edge: #6887c0;      /* the outline of anything typed into or pressed: 3:1 against panel and navy */
  --lime: rgb(174 250 10);
  --text: #fff;
  --muted: #aebcd8;
  --amber: #ffb829;
  --sky: #72d2ff;
  --red: #ff7b6e;
  --display: "Protest Strike", "Arial Black", Impact, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template: 56px minmax(0, 1fr) / 268px minmax(0, 1fr);
  background: var(--navy);
  color: var(--text);
  font: 14px/1.45 var(--body);
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; }
p { margin: 0; }
code, .key { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
main:focus { outline: none; }

.skip { position: absolute; left: 8px; top: -60px; z-index: 60; background: var(--lime); color: var(--ink); padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 8px; }

/* --- header --- */

.top {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 22px;
  padding: 0 18px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.brand { font: 22px/1 var(--display); white-space: nowrap; }
.brand small { font: 13px var(--body); color: var(--muted); margin-left: 4px; }

/* The game version being edited: always in sight, and the way to change to another. */
.game-pick { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); }
.game-pick select { width: auto; max-width: 300px; font-weight: 600; border-color: #fff; background: var(--navy); }

#live { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--muted); }
.sticker {
  font: 16px/1 var(--display);
  background: var(--lime); color: var(--ink);
  padding: 5px 10px 6px; border-radius: 4px;
  rotate: -3deg; white-space: nowrap;
}
.live-when { white-space: nowrap; }
.live-note { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-none { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top-right { display: flex; align-items: center; gap: 16px; margin-left: auto; white-space: nowrap; }
.save-state { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); min-width: 68px; }
.save-state.failed { color: var(--red); }
.draft-state { color: var(--muted); }
.draft-state.pending { color: var(--sky); font-weight: 600; }
.draft-state.scheduled { color: var(--text); }

/* --- sidebar --- */

#nav {
  background: var(--ink);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 8px 10px 28px;
}
/* Trees (the sidebar, the texts categories): rows of a twist button, a link and its counts. */
.tree, .tree-kids { list-style: none; margin: 0; padding: 0; }
.tree-kids { padding-left: 12px; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; color: var(--muted); }
.tree-row:hover { background: var(--panel); color: var(--text); }
.tree-row.current { background: var(--navy); color: var(--text); box-shadow: inset 3px 0 0 #fff; }
.tree-row > a { flex: 1; min-width: 0; display: flex; align-items: center; padding: 5px 4px 5px 2px; color: inherit; text-decoration: none; border-radius: 6px; }
.tree-row > a:focus-visible { outline-offset: -2px; }
.marks { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 0 4px; }
.marks:empty { display: none; }
.twist { flex: none; width: 20px; height: 24px; padding: 0; border: 0; background: none; color: inherit; display: grid; place-items: center; }
button.twist { cursor: pointer; border-radius: 4px; }
button.twist .icon { width: 14px; height: 14px; transition: rotate .12s; }
button.twist[aria-expanded="true"] .icon { rotate: 90deg; }
.tree-row.module { margin-top: 12px; color: var(--text); }
.tree-row.module > a { font: 17px/1.2 var(--display); padding-block: 8px; }
.tree-row.category > a { color: var(--text); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sky); flex: none; }
.badge {
  flex: none;
  min-width: 22px; padding: 0 6px; border-radius: 10px;
  border: 1px solid var(--amber); color: var(--amber);
  font: 600 12px/18px var(--body); text-align: center;
}
.scheduled-mark { display: inline-flex; align-items: center; gap: 3px; font: 13px var(--body); color: var(--muted); }

/* --- the page --- */

main { overflow: auto; padding: 0 28px 96px; min-width: 0; scroll-padding-top: var(--bar, 64px); }   /* what scrolls into view lands below the sticky bar */
main > * { max-width: 1320px; }   /* a very wide window does not pull a label away from its control */
main > .texts-layout { max-width: 1760px; }

.toolbar {
  position: sticky; top: 0; left: 0; z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 18px 0 12px;
  background: var(--navy);
}
.toolbar h1 { font-size: 30px; margin-right: auto; }
.title { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.title h1 { margin: 0; }
.title-pic:empty { display: none; }
.title-pic .pic { width: 46px; height: 46px; border-radius: 8px; }
.page-help { color: var(--muted); margin: -4px 0 16px; max-width: 80ch; }

/* Breadcrumbs: Module > Category > Sub-category > Group. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; color: var(--muted); font: 13px/1.3 var(--body); }
.toolbar > .crumbs { flex-basis: 100%; margin-bottom: -6px; }
.crumbs a { color: var(--muted); text-decoration: none; border-radius: 3px; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); }
.crumbs .icon { width: 12px; height: 12px; opacity: .7; }

/* Cards to browse down: what is filed under a module or a category. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.tile {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; min-height: 112px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.tile:hover { border-color: var(--edge); background: #11284f; }
.tile > .pic { width: 76px; height: 76px; flex: none; border-radius: 8px; }
.tile-text { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; gap: 6px; }
.tile h2 { font-size: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile h2 .icon { width: 16px; height: 16px; color: var(--muted); }
.tile-line { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { margin-top: auto; padding-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.count-line { color: var(--muted); margin: 0 0 8px; }
.loading, .empty { color: var(--muted); padding: 40px 0; }
.sentinel { height: 1px; }

.state-page { max-width: 60ch; padding: 64px 0; display: grid; gap: 14px; justify-items: start; }
.state-page h1 { font-size: 34px; }

.notice {
  display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--sky); border-radius: 6px;
  padding: 9px 12px; margin: 0 0 16px;
}
.notice .icon { margin-top: 2px; }
.notice.warn { border-left-color: var(--amber); }
details.notice { display: block; }
details.notice summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.keys { margin: 8px 0; padding-left: 20px; overflow-wrap: anywhere; }

/* --- things typed into or pressed --- */

input[type="text"], input[type="search"], input[type="password"], input[type="datetime-local"], select, textarea {
  font: inherit; color: var(--text);
  background: var(--ink);
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 6px 9px; min-height: 34px; width: 100%;
}
textarea { resize: vertical; field-sizing: content; line-height: 1.4; display: block; }
select { cursor: pointer; }
::placeholder { color: #8ea1c6; opacity: 1; }
input:disabled { opacity: .5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 14px/1.2 var(--body); color: var(--text);
  background: transparent;
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 6px 14px; min-height: 34px;
  cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--raise); }
.btn.primary {
  font: 17px/1.1 var(--display); letter-spacing: .02em;
  background: var(--lime); border-color: var(--lime); color: var(--ink);
  padding: 6px 18px 7px;
}
.btn.primary:hover:not(:disabled) { background: #c8ff45; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.quiet { border-color: transparent; }
.btn.square { padding: 6px; }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.reset {
  display: inline-flex; align-items: center; gap: 4px;
  font: 600 12px/1.2 var(--body); color: var(--amber);
  background: transparent; border: 1px solid var(--amber); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; white-space: nowrap;
}
.reset:hover { background: rgb(255 184 41 / .14); }

.search-box {
  display: flex; align-items: center; gap: 6px;
  width: min(300px, 100%);
  background: var(--ink); border: 1px solid var(--edge); border-radius: 6px;
  padding: 0 10px; color: var(--muted);
}
.search-box:focus-within { outline: 2px solid #fff; outline-offset: 2px; }
.search-box .search { border: 0; background: transparent; padding: 0; outline: none; color: var(--text); }
.toolbar select { width: auto; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: #fff; margin: 0; }

.switch {
  appearance: none; flex: none;
  width: 42px; height: 24px; margin: 0;
  background: var(--ink); border: 1px solid var(--edge); border-radius: 12px;
  position: relative; cursor: pointer;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  transition: translate .12s;
}
.switch:checked { background: #e9f0ff; border-color: #e9f0ff; }
.switch:checked::before { translate: 18px 0; background: var(--navy); }
.switch-row { display: inline-flex; align-items: center; gap: 10px; }
.switch-word { min-width: 2.2em; }

.error { color: var(--red); font-size: 13px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 13px; }

.tag { font: 12px/1.2 var(--body); padding: 2px 8px; border: 1px solid currentColor; border-radius: 10px; white-space: nowrap; }
.unpublished-tag { color: var(--sky); display: none; }
.unpublished .unpublished-tag { display: inline-block; }
.chip { font-size: 12px; background: var(--raise); padding: 1px 8px; border-radius: 10px; white-space: nowrap; }

/* --- settings --- */

.block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin: 0 0 18px; }
.block > h2 { font-size: 19px; padding: 11px 16px; display: flex; align-items: center; gap: 4px; }
.block > h2 .crumbs { font: inherit; color: var(--muted); }
.block > h2 .crumbs a { color: var(--text); }
.place { color: var(--muted); font-size: 12.5px; }

/* A group's page: sections that close, their sub-sections inside, and the jump list beside them. */
.group-layout { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 24px; align-items: start; }
.group-layout.alone { grid-template-columns: minmax(0, 1fr); }
.group-layout > .fields { grid-column: 1; grid-row: 1; min-width: 0; }
details.block, details.sub { scroll-margin-top: 8px; }
.rows { min-height: calc(var(--row, 74px) * var(--n)); }   /* rows not drawn yet keep their place */
.rows.drawn { min-height: 0; }
summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; border-radius: 7px; }
summary::-webkit-details-marker { display: none; }
summary > .icon { width: 14px; height: 14px; color: var(--muted); transition: rotate .12s; }
details[open] > summary > .icon { rotate: 90deg; }
summary:focus-visible { outline-offset: -2px; }
summary .count { margin-right: auto; }
details.block > summary { padding: 11px 16px 11px 12px; }
details.block > summary h2 { font-size: 19px; }
details.sub { border-top: 1px solid var(--line); }
details.sub > summary { padding: 8px 16px 8px 26px; background: rgb(12 18 30 / .3); border-radius: 0; }
details.sub > summary h3 { font-size: 15.5px; letter-spacing: .01em; }
details.sub .field { padding-left: 40px; }

.jump {
  grid-column: 2; grid-row: 1;
  position: sticky; top: calc(var(--bar, 64px) + 4px);
  max-height: calc(100vh - 56px - var(--bar, 64px) - 24px); overflow: auto;
  padding: 0 2px 8px 0;
}
.jump h2 { font-size: 15px; color: var(--muted); padding: 2px 8px 6px; }
.jump ol { list-style: none; margin: 0; padding: 0; }
.jump ol ol { margin: 0 0 4px 14px; padding-left: 6px; border-left: 1px solid var(--line); }
.jump-link {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 4px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.jump ol ol .jump-link { color: var(--muted); padding-block: 3px; }
.jump-link:hover { background: var(--panel); color: var(--text); }
.jump-link:focus-visible { outline-offset: -2px; }
.jump-link .badge { margin-left: auto; }
.jump-tools { display: flex; gap: 8px; padding: 10px 8px 0; }
.field {
  display: grid;
  grid-template-columns: minmax(190px, 5fr) minmax(290px, 6fr) minmax(170px, 4fr);
  gap: 4px 22px; align-items: start;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}
.field.changed { box-shadow: inset 3px 0 0 var(--amber); }
.field-info label { font-weight: 600; font-size: 14.5px; display: block; }
/* Help in plain words: two lines, and a "More" for the rest. */
.help { color: var(--muted); max-width: 72ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.help.open { display: block; }
.more { background: none; border: 0; padding: 0; margin-top: 1px; color: var(--text); font: 12.5px var(--body); text-decoration: underline; cursor: pointer; }
.key { color: #9fb1d3; overflow-wrap: anywhere; }
/* The technical name and the stored value, out of the way until asked for. */
.tech { margin-top: 4px; font-size: 12px; color: var(--muted); }
.tech > summary { display: inline-flex; gap: 5px; font-size: 12px; color: #8ea1c6; border-radius: 3px; }
.tech > summary::before { content: "+"; }
.tech[open] > summary::before { content: "\2212"; }
.tech > code, .tech > span { display: block; margin-top: 2px; }
.field-control { min-width: 0; }
.field-control select { width: auto; min-width: 190px; max-width: 100%; }
.field-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; color: var(--muted); font-size: 13px; min-height: 34px; }
.builtin b { color: var(--text); font-weight: 600; display: inline-block; max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.invalid input, .invalid textarea { border-color: var(--red); }

.num { max-width: 150px; font-variant-numeric: tabular-nums; }
.num.bad { border-color: var(--red); }

/* A number: slider, box, unit. The slider's track shows the built-in value as a tick and, in amber, how far the
   value has moved away from it. */
.numeric { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.numeric .num { width: 86px; text-align: right; }
.unit { color: var(--muted); min-width: 1.4em; }
.slider { position: relative; flex: 1 1 130px; min-width: 110px; max-width: 300px; height: 30px; }
.slider::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 2px; background: #3d5d93; }
.slider .away {
  position: absolute; top: 13px; height: 4px; border-radius: 2px; background: var(--amber);
  left: calc(8px + (100% - 16px) * min(var(--at, 0), var(--cur, 0)));
  width: calc((100% - 16px) * (max(var(--at, 0), var(--cur, 0)) - min(var(--at, 0), var(--cur, 0))));
}
.slider .mark { position: absolute; top: 7px; left: calc(8px + (100% - 16px) * var(--at, 0)); width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: #e9f0ff; }
.slider input[type="range"] { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer; }
.slider input[type="range"]::-webkit-slider-runnable-track { height: 30px; background: transparent; }
.slider input[type="range"]::-moz-range-track { height: 30px; background: transparent; }
.slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: 7px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 0 0 1px var(--edge); }
.slider input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 0 0 1px var(--edge); }
.slider.outside input[type="range"]::-webkit-slider-thumb { background: var(--amber); }
.slider.outside input[type="range"]::-moz-range-thumb { background: var(--amber); }
.slider input[type="range"]:focus-visible { outline: 2px solid #fff; outline-offset: 0; border-radius: 4px; }
.outside-note { flex-basis: 100%; color: var(--amber); font-size: 12px; }
.vector { display: flex; gap: 10px; }
.vector label { display: flex; align-items: center; gap: 5px; color: var(--muted); min-width: 0; }
.vector .num { max-width: 96px; }
.color { display: flex; align-items: center; gap: 8px; }
input[type="color"] { width: 46px; height: 34px; padding: 2px; background: var(--ink); border: 1px solid var(--edge); border-radius: 6px; cursor: pointer; flex: none; }
.hex { max-width: 124px; font-family: var(--mono); }

/* --- texts --- */

/* The category tree beside the table. */
.texts-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 20px; align-items: start; }
.texts-layout.alone { grid-template-columns: minmax(0, 1fr); }
.cat-tree {
  position: sticky; top: calc(var(--bar, 64px) + 4px);
  max-height: calc(100vh - 56px - var(--bar, 64px) - 24px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px;
}
.cat-tree .tree-row:hover { background: var(--raise); }
.cat-tree .tree-row.current { background: var(--ink); }
.cat-tree .tree-kids { padding-left: 12px; }
a.chip { color: var(--text); text-decoration: none; white-space: normal; }
a.chip:hover { background: var(--edge); color: var(--ink); }

table.texts {
  width: 100%; table-layout: fixed;
  border-collapse: separate; border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
}
.texts thead th {
  position: sticky; top: var(--bar, 64px); z-index: 2;
  background: var(--ink);
  font: 16px/1.2 var(--display); text-align: start;
  padding: 9px 12px; width: 176px;   /* the least a column gets; a table too wide for the page scrolls sideways */
}
.texts thead th:first-child { border-top-left-radius: 7px; }
.texts thead th:last-child { border-top-right-radius: 7px; }
.texts thead th small { font: 12px var(--body); color: var(--muted); margin-inline-start: 8px; }
.texts tbody th, .texts td { border-top: 1px solid var(--line); vertical-align: top; text-align: start; }
.texts tbody th { font-weight: 400; padding: 10px 12px; }
/* The source column stays put when many languages make the table scroll sideways. */
.texts tbody th { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: 1px 0 0 var(--line); }
.texts thead th:first-child { left: 0; z-index: 3; }
.texts td { padding: 4px 6px 6px; }
.texts td.changed { box-shadow: inset 3px 0 0 var(--amber); }
.source-text { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; }
.source-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 5px; }
.note { color: var(--muted); font-size: 12.5px; }
.texts textarea { background: transparent; border-color: transparent; min-height: 32px; resize: none; }
.texts textarea:hover { border-color: var(--line); }
.texts textarea:focus { background: var(--ink); border-color: var(--edge); }
.texts td.missing textarea { border: 1px dashed var(--edge); }
.cell-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; padding: 0 3px; }
.cell-warn { color: var(--amber); font-size: 12.5px; margin-inline-end: auto; }

/* --- events and versions --- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 16px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 12px; }
.card-pic { width: 100%; height: auto; max-height: 170px; object-fit: contain; object-position: left center; }
.card.changed { box-shadow: inset 3px 0 0 var(--amber); }
.card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h2 { font-size: 23px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.card-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.state-more { color: var(--muted); font-size: 13px; white-space: nowrap; }
.for { color: var(--muted); }
.date-row { display: grid; grid-template-columns: 52px minmax(0, 220px) auto; gap: 4px 8px; align-items: center; }
.date-row .hint { grid-column: 2 / -1; }
.date-row .btn { justify-self: start; }
.date-label { font-weight: 600; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-actions .reset { margin-left: auto; padding: 6px 10px; }
.pending-strip { display: none; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--sky); }
.card.unpublished .pending-strip { display: flex; }

.state { font: 14px/1 var(--display); padding: 5px 10px 6px; border-radius: 4px; border: 1px solid var(--muted); color: var(--muted); white-space: nowrap; }
.state.live { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.state.soon, .state.scheduled { border-color: #fff; color: #fff; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 1000px; }
.version { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.version.live { border-color: var(--lime); }
.version-row { display: flex; align-items: center; gap: 10px; padding-right: 12px; }
.version-head {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: 18px 58px 92px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-radius: 8px;
  color: inherit; text-decoration: none;
}
.version-head:hover { background: rgb(255 255 255 / .04); }
.version-head .icon { color: var(--muted); transition: rotate .12s; }
.version.open .version-head .icon { rotate: 90deg; }
.version-head .state { justify-self: start; }
.number { font: 23px/1 var(--display); }
.version-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.version-detail { border-top: 1px solid var(--line); padding: 16px; display: grid; gap: 14px; }
.version-detail h3 { font-size: 18px; }
.version-detail summary { cursor: pointer; margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* The Game versions page. */
table.games { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.games th, .games td { text-align: start; padding: 10px 14px; vertical-align: middle; }
.games thead th { font: 15px/1.2 var(--display); background: var(--ink); }
.games thead th:first-child { border-top-left-radius: 7px; }
.games thead th:last-child { border-top-right-radius: 7px; }
.games tbody th, .games tbody td { border-top: 1px solid var(--line); font-weight: 400; }
.games tbody tr.here { box-shadow: inset 3px 0 0 #fff; }
.games tbody th > * { margin-right: 8px; vertical-align: middle; }
.game-name { font: 20px/1.1 var(--display); color: var(--text); text-decoration: none; }
.game-name:hover { text-decoration: underline; }
.game-note { margin-left: 8px; }
.games .scheduled-mark { margin-left: 10px; }
.game-actions { white-space: nowrap; text-align: end; }
.game-actions .btn { margin-left: 6px; text-decoration: none; }
.unpublished-tag.shown { display: inline-block; }

/* --- lists of changes --- */

.changes { display: grid; gap: 14px; }
.changes h4 { font-size: 17px; display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.count { font: 13px var(--body); color: var(--muted); }
.changes ul { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.changes li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 2px 18px; padding: 7px 12px; border-top: 1px solid var(--line); }
.changes li:first-child { border-top: 0; }
.what small { display: block; color: var(--muted); font-size: 12.5px; }
.what bdi, .value bdi { white-space: pre-wrap; overflow-wrap: anywhere; }
.values { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.values .icon { color: var(--muted); align-self: center; }
.value { font-weight: 600; min-width: 0; }
.value.builtin { color: var(--muted); font-weight: 400; }
.value small { font-size: 11.5px; border: 1px solid currentColor; border-radius: 8px; padding: 0 6px; margin-inline-start: 6px; white-space: nowrap; }

/* --- dialogs and toasts --- */

dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0;
  background: var(--navy); color: var(--text);
  border: 1px solid var(--edge); border-radius: 10px;
}
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(12 18 30 / .8); }
dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
dialog h2 { font-size: 23px; }
dialog form { display: flex; flex-direction: column; min-height: 0; }
.dialog-body { display: grid; gap: 14px; padding: 16px 18px; overflow: auto; align-content: start; }
.dialog-body.pinned { flex: none; overflow: visible; border-top: 1px solid var(--line); }
dialog footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 18px; background: var(--ink); border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; }
.sure { margin-right: auto; font-weight: 600; }
.stack { display: grid; gap: 5px; }
.stack > span, legend { font-weight: 600; }
.go-live { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.choice input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: #fff; }
.choice input[type="datetime-local"] { width: auto; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); border: 1px solid var(--edge); border-left: 4px solid #fff; border-radius: 6px; padding: 10px 14px; }
.toast.error { border-left-color: var(--red); }

/* --- pictures --- */

.pic { display: block; object-fit: cover; border-radius: 6px; }
.thumb { width: 20px; height: 20px; flex: none; border-radius: 4px; margin-right: 7px; }
.block > h2 .thumb { width: 24px; height: 24px; margin-right: 6px; }

/* --- views: an arc, a sweep, a body --- */

.view-block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin: 0 0 18px; overflow: hidden; }
.view-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.view-main { min-width: 0; background: var(--ink); }
.view-stage { position: relative; overflow: hidden; }
.view-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.view-stage canvas:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.view-facts { margin: 0; padding: 8px 12px; color: var(--muted); font-size: 13.5px; border-top: 1px solid var(--line); }
.view-side { border-left: 1px solid var(--line); padding: 12px 14px 16px; overflow: auto; max-height: 520px; }
.view-side h3 { font-size: 16.5px; margin-bottom: 6px; }
.view-range { width: 180px; accent-color: var(--lime); }
.view-note { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.view-side .field { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 9px 0 9px 8px; }
.view-side .field-meta { justify-content: flex-start; min-height: 0; }
@media (max-width: 1000px) { .view-body { grid-template-columns: 1fr; } .view-side { border-left: 0; border-top: 1px solid var(--line); max-height: none; } }

/* --- the map --- */

.map-block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin: 0 0 18px; overflow: hidden; }
.map-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.map-hint { color: var(--muted); font-size: 13px; margin: 0 auto 0 6px; }
.map-where { min-width: 17ch; text-align: right; white-space: pre; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.map-stage { position: relative; height: min(68vh, 720px); min-height: 380px; background: var(--ink); }
.map-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.map-stage canvas.over { cursor: pointer; }
.map-stage canvas.dragging { cursor: grabbing; }
.map-stage canvas:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.map-tip { position: absolute; z-index: 2; pointer-events: none; white-space: pre; background: var(--ink); border: 1px solid var(--edge); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; }
.map-side { border-left: 1px solid var(--line); padding: 12px 14px 16px; overflow: auto; max-height: min(68vh, 720px); }
.map-side h3 { font-size: 16.5px; margin-bottom: 6px; }
.map-layers { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 1px; }
.map-layers li { display: flex; align-items: center; gap: 6px; }
.map-layers label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 3px 0; cursor: pointer; }
.map-layers input { width: 15px; height: 15px; margin: 0; accent-color: #fff; }
.map-layers .btn { min-height: 24px; padding: 1px 8px; font-size: 12px; }
.swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.btn[aria-pressed="true"] { background: #e9f0ff; border-color: #e9f0ff; color: var(--ink); }
.map-point { border-top: 1px solid var(--line); padding-top: 12px; }
.map-xy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 6px; }
.map-xy label { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.map-xy .num { width: 78px; text-align: right; }
.map-side .field { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 9px 0 9px 8px; }
.map-side .field-meta { justify-content: flex-start; min-height: 0; }
.kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.kind { display: grid; justify-items: center; align-content: start; gap: 2px; padding: 5px 2px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: 11.5px/1.2 var(--body); cursor: pointer; }
.kind .pic { width: 38px; height: 38px; object-fit: contain; }
.kind:hover { border-color: var(--edge); color: var(--text); }
.kind[aria-pressed="true"] { border-color: #fff; box-shadow: inset 0 0 0 1px #fff; color: var(--text); }

/* --- narrower screens --- */

@media (max-width: 1180px) {
  .live-note { display: none; }
  body { grid-template-columns: 224px minmax(0, 1fr); }
  main { padding-inline: 20px; }
  .field { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-meta { grid-column: 1 / -1; justify-content: flex-start; min-height: 0; }
  /* The jump list and the category tree go above what they belong to, each scrolling within a short box. */
  .group-layout, .texts-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .group-layout > .fields, .jump { grid-column: 1; grid-row: auto; }
  .jump, .cat-tree { position: static; max-height: 220px; }
  .jump { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; }
  details.sub .field { padding-left: 24px; }
  .map-body { grid-template-columns: minmax(0, 1fr); }
  .map-side { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .map-stage { height: min(60vh, 520px); }
}

@media (max-width: 860px) {
  .brand small, .live-when { display: none; }
  .top { gap: 12px; padding-inline: 12px; }
  .top-right { gap: 10px; }
  .save-state { min-width: 0; }
  .version-head { grid-template-columns: 18px 50px 88px minmax(0, 1fr); }
  .version-head .when { grid-column: 2 / -1; }
}

@media (max-width: 700px) {
  body { display: block; height: auto; }
  .top { flex-wrap: wrap; padding-block: 8px; position: sticky; top: 0; z-index: 5; }
  #nav { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
  main { overflow: visible; }
  .toolbar { position: static; }
  .texts thead th { position: static; }
  .field { grid-template-columns: minmax(0, 1fr); }
  .changes li { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; }
}

/* --- analytics and tests --- */

.analytics-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; }
.segmented { display: inline-flex; gap: 4px; }
.stack-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.group-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-toggle { border-left: 4px solid var(--chip); }
.chip-toggle[aria-pressed="false"] { opacity: .45; background: transparent; color: var(--muted); border-color: var(--line); border-left-color: var(--chip); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--chip); border-radius: 8px; padding: 12px 14px; }
.kpi-card h3 { margin: 0 0 8px; font-size: 16px; }
.kpi-card dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0; font-size: 13.5px; }
.kpi-card dt { color: var(--muted); }
.kpi-card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.chart { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.chart header h3 { margin: 0; font-size: 15.5px; }
.chart header p { margin: 2px 0 8px; color: var(--muted); font-size: 12.5px; }
.chart-svg { width: 100%; height: auto; display: block; touch-action: none; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; }
.chart-svg .cursor { stroke: #e9f0ff; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 46px; z-index: 3; pointer-events: none; background: var(--ink); border: 1px solid var(--edge); border-radius: 6px; padding: 6px 9px; font-size: 12.5px; min-width: 130px; }
.chart-tip div, .chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-tip i, .chart-legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bar-track { display: grid; gap: 2px; }
.bar { height: 14px; border-radius: 3px; position: relative; min-width: 2px; }
.bar em { position: absolute; left: calc(100% + 6px); top: -2px; font-style: normal; font-size: 12px; color: var(--text); white-space: nowrap; }
.compare { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.compare h2 { margin: 0; font-size: 18px; }
.table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.compare-table td.best { color: var(--lime); font-weight: 700; }
.delta { margin-left: 6px; font-size: 12px; color: var(--muted); }
.delta.up { color: var(--lime); }
.delta.down { color: var(--red); }
.tests { display: grid; gap: 14px; }
.test-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 12px; }
.test-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.test-card h2 { margin: 0; font-size: 19px; }
.status-running { background: var(--lime); color: var(--ink); }
.status-promoted { background: var(--sky); color: var(--ink); }
.share-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; }
.share-bar span { display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 12px; font-weight: 700; min-width: 30px; }
.test-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.test-group, .test-edit-group { border: 1px solid var(--line); border-left: 4px solid var(--chip); border-radius: 6px; padding: 8px 10px; }
.test-group h3 { margin: 0 0 6px; font-size: 15px; }
.test-changes { margin: 0 0 6px; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
.test-edit-groups { display: grid; gap: 10px; margin: 12px 0; }
.test-edit-group header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.test-edit-group header input[type="text"] { flex: 1; }
.promote { display: inline-flex; gap: 6px; align-items: center; }
