:root {
  --bg: #f4f1eb;
  --ink: #171717;
  --muted: #66625c;
  --line: #d9d1c4;
  --panel: #fffdfa;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --gold: #b98228;
  --shadow: 0 16px 40px rgba(20, 20, 20, 0.12);
}

.edition-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.edition-option { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: .9rem; }
.edition-option.is-current { border-color: var(--accent); background: var(--accent); color: white; }
.edition-tag { font-size: .7rem; border: 1px solid currentColor; border-radius: 4px; padding: 1px 4px; }
.compatibility-tag { color: var(--muted); font-size: .85rem; }
.suit-shape-mark { display: inline-block; width: 22px; height: 28px; background: currentColor; }
.suit-shape-mark.hard { border-radius: 3px; }
.suit-shape-mark.soft { border-radius: 50%; }
.suit-shape-mark[data-suit-color="Black"] { color: #282828; }
.suit-shape-mark[data-suit-color="Red"] { color: #b01e2f; }
.suit-shape-mark[data-suit-color="Blue"] { color: #3f4eab; }
.suit-shape-mark[data-suit-color="Yellow"] { color: #b08f00; }
.suit-shape-mark[data-suit-color="Green"] { color: #2c7f2f; }
[data-edition="v1"] .suit-shape-mark[data-suit-color="Red"] { color: #b01f2f; }
[data-edition="v1"] .suit-shape-mark[data-suit-color="Blue"] { color: #3f4daa; }
[data-edition="v1"] .suit-shape-mark[data-suit-color="Green"] { color: #2b7f2f; }
.standard-deck-mark { display: inline-block; width: 28px; height: 28px; background: currentColor; clip-path: polygon(0 0, 100% 0, 0 100%); }
.icon-half-pair { display: inline-flex; align-items: center; gap: 12px; }
.icon-half-bar.is-mirrored { transform: scaleX(-1); }
.instance-card.system-instance-icon-halves { grid-template-columns: 110px minmax(0, 1fr); }
.system-instance-icon-halves .system-instance-art { width: 110px; }
.system-instance-art .icon-half-pair img { width: 44px; max-height: 32px; }
.filter-action-visual .icon-half-pair { gap: 6px; }
.filter-action-visual .icon-half-pair img { width: 22px; max-height: 20px; }
@media (max-width: 650px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .edition-switch { width: 100%; }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 235, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
}

.navlinks {
  display: flex;
  gap: 8px;
}

.navlinks a,
.button,
.pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.navlinks a {
  padding: 9px 12px;
}

.button {
  padding: 11px 14px;
  cursor: pointer;
}

.compact-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 28px 24px;
  color: var(--muted);
}

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: center;
  gap: clamp(28px, 6vw, 88px);
  min-height: calc(100vh - 128px);
  padding: clamp(28px, 6vw, 80px);
}

.home h1,
.page-band h1,
.filters h1,
.detail h1 {
  margin: 0;
  line-height: 0.95;
  letter-spacing: 0;
}

.home h1 {
  font-size: clamp(4rem, 12vw, 10rem);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede {
  max-width: 780px;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  line-height: 1.5;
}

.actions,
.quick-filters,
.glyph-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-card img {
  width: min(100%, 390px);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) minmax(260px, 360px);
  min-height: calc(100vh - 64px);
}

.filters,
.selected-card {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  overflow: auto;
  border-color: var(--line);
  background: rgba(255, 253, 250, 0.76);
}

.filters {
  padding: 16px;
  border-right: 1px solid var(--line);
}

.filters h1 {
  margin-bottom: 10px;
  font-size: 2.2rem;
}

.matrix-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
}

.filter-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-clear {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.filters label {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.more-filters {
  margin-top: 8px;
}

.more-filters summary {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 900;
}

.more-filters[open] summary {
  margin-bottom: 6px;
}

.filters input,
.filters select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font: inherit;
}

.filters input.is-filtered,
.filters select.is-filtered {
  border-color: var(--accent);
  background: #e9f5f3;
  box-shadow: inset 3px 0 0 var(--accent);
}

.card-results {
  display: grid;
  grid-template-rows: auto minmax(0, auto) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  height: calc(100vh - 64px);
  padding: 18px;
  overflow: hidden;
}

.phone-only {
  display: none;
}

.matrix-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.matrix-toolbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 240px) minmax(160px, 240px) auto auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.76);
}

.matrix-toolbar h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.95;
}

.matrix-toolbar .back-link {
  margin-bottom: 6px;
}

.matrix-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.matrix-toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font: inherit;
}

.matrix-main {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto;
  gap: 14px;
  min-width: 0;
  height: calc(100vh - 149px);
  padding: 18px;
  overflow: hidden;
}

.matrix-scroll {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.matrix-table th,
.matrix-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  text-align: center;
  white-space: nowrap;
}

.matrix-table th {
  position: sticky;
  z-index: 2;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.matrix-table thead th {
  top: 0;
  padding: 9px 10px;
}

.matrix-table tbody th {
  left: 0;
  min-width: 120px;
  padding: 9px 10px;
  text-align: left;
}

.matrix-table thead th:first-child {
  left: 0;
  z-index: 3;
  text-align: left;
}

.matrix-total-heading,
.matrix-total-row th {
  background: #f3eadb;
  color: var(--ink);
}

.matrix-cell {
  display: block;
  min-width: 78px;
  width: 100%;
  min-height: 42px;
  border: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.matrix-cell.is-heatmapped {
  background: var(--heat-bg, #fff);
}

.matrix-cell:hover,
.matrix-cell:focus-visible,
.matrix-cell.is-selected {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  outline-offset: -2px;
}

.matrix-cell.is-empty {
  color: #3f3a34;
  font-weight: 850;
}

.matrix-cell.is-total {
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(185, 130, 40, 0.2);
}

.matrix-cell.is-grand-total {
  background: #ead8b9;
}

.matrix-cell.is-total:hover,
.matrix-cell.is-total:focus-visible,
.matrix-cell.is-total.is-selected {
  outline-color: rgba(185, 130, 40, 0.38);
}

.matrix-results {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 210px;
}

.matrix-results-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.matrix-results-bar strong {
  margin-right: auto;
}

.matrix-thumb-scroll {
  max-height: 280px;
}

.matrix-selected-card {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  overflow: auto;
  background: rgba(255, 253, 250, 0.76);
}

a[aria-disabled="true"] {
  opacity: 0.52;
  pointer-events: none;
}

.results-bar {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
}

.results-bar span {
  color: var(--accent);
  font-size: 1.45rem;
}

.table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.card-table th,
.card-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.card-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.card-table tr {
  cursor: pointer;
}

.card-table tr:hover,
.card-table tr.is-selected {
  background: #efe7da;
}

.thumb-scroll {
  max-height: 430px;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.48);
  padding: 12px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 12px;
}

.thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 7px;
  cursor: pointer;
}

.thumb.is-selected {
  outline: 3px solid var(--accent);
}

.thumb img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 5px;
}

.thumb span {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-card {
  padding: 18px;
  border-left: 1px solid var(--line);
}

.selected-card img {
  width: min(100%, 310px);
  margin: 0 auto 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.selected-card h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.filter-action {
  position: relative;
  display: grid;
  grid-template-rows: 12px minmax(0, 1fr) 13px;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  gap: 2px;
  padding: 5px;
  text-decoration: none;
}

.filter-action.is-filter-active {
  border-color: var(--accent);
  background: #e9f5f3;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.22);
}

.filter-action.is-filter-active::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-top-right-radius: 7px;
  background: var(--accent);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  content: "";
}

.filter-action:hover,
.filter-action:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.18);
  outline-offset: 2px;
}

.filter-action img {
  width: 30px;
  max-height: 30px;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

.filter-action-caption,
.filter-action-value {
  overflow: hidden;
  max-width: 100%;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-action-caption {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.filter-action-value {
  font-size: 0.62rem;
  font-weight: 850;
}

.filter-action-visual {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.filter-action-text {
  color: var(--accent);
  font-size: 1.08rem;
  font-weight: 900;
}

.tau-glyph {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", serif;
  font-size: 1.5rem;
  line-height: 1;
}

.border-mini {
  position: relative;
  width: 24px;
  height: 32px;
  border: 1px solid #8d8476;
  border-radius: 4px;
  background: #fffdfa;
}

.border-mini .chevrons {
  position: absolute;
  display: none;
}

.border-mini.has-top .top,
.border-mini.has-right .right,
.border-mini.has-bottom .bottom,
.border-mini.has-left .left {
  display: block;
}

.border-mini .top,
.border-mini .bottom {
  left: 5px;
  width: 12px;
  height: 6px;
}

.border-mini .top {
  top: 2px;
  background: #b8b3aa;
  clip-path: polygon(0 0, 24% 0, 50% 58%, 76% 0, 100% 0, 50% 100%);
}

.border-mini .bottom {
  bottom: 2px;
  background: #b8b3aa;
  clip-path: polygon(0 100%, 24% 100%, 50% 42%, 76% 100%, 100% 100%, 50% 0);
}

.border-mini .left,
.border-mini .right {
  top: 10px;
  width: 6px;
  height: 12px;
}

.border-mini .left {
  left: 2px;
  background: #b8b3aa;
  clip-path: polygon(0 0, 0 24%, 58% 50%, 0 76%, 0 100%, 100% 50%);
}

.border-mini .right {
  right: 2px;
  background: #b8b3aa;
  clip-path: polygon(100% 0, 100% 24%, 42% 50%, 100% 76%, 100% 100%, 0 50%);
}

.selected-card .button.primary {
  margin-top: 4px;
}

.selected-card dl,
.metadata {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
}

.selected-card dt,
.metadata dt {
  color: var(--muted);
  font-weight: 900;
}

.selected-card dd,
.metadata dd {
  margin: 0;
}

.page-band,
.detail {
  padding: clamp(24px, 5vw, 72px);
}

.page-band h1,
.detail h1 {
  font-size: clamp(2.5rem, 7vw, 5.8rem);
}

.system-grid,
.instance-grid,
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.instance-row-break {
  grid-column: 1 / -1;
  height: 10px;
}

.system-card,
.instance-card,
.game-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  text-decoration: none;
}

.system-card span,
.game-status {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.system-card h2,
.instance-card h2 {
  margin: 8px 0;
}

.system-card p,
.instance-card p,
.game-card p {
  color: var(--muted);
  line-height: 1.45;
}

.instance-card p {
  margin: 0;
}

.system-card strong {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.9rem;
}

.game-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 180px) minmax(150px, 190px);
  gap: 10px;
  max-width: 920px;
  margin-top: 22px;
}

.game-tools input,
.game-tools select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}

.game-card {
  display: grid;
  gap: 8px;
}

.game-card h2 {
  margin: 0;
}

.game-stats,
.game-detail-stats {
  display: grid;
  gap: 8px;
  margin: 0;
}

.game-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.game-stats div,
.game-detail-stats div {
  min-width: 0;
}

.game-stats dt,
.game-detail-stats dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.game-stats dd,
.game-detail-stats dd {
  margin: 2px 0 0;
  font-weight: 900;
}

.game-components {
  margin: 0;
  font-size: 0.9rem;
}

.game-detail {
  padding: clamp(24px, 5vw, 72px);
}

.game-detail-hero {
  max-width: 980px;
}

.game-detail-hero h1 {
  margin: 6px 0 0;
  font-size: clamp(2.7rem, 7vw, 6.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.game-detail-stats {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  max-width: 760px;
  margin-top: 22px;
}

.game-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.game-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 26px;
  margin-top: 34px;
}

.game-rules {
  display: grid;
  gap: 14px;
}

.game-rules section,
.game-zones {
  border-top: 3px solid var(--accent);
  background: rgba(255, 253, 250, 0.58);
  padding-top: 14px;
}

.game-rules h2,
.game-zones h2,
.mapping-heading h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
}

.game-rules p,
.mapping-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.game-zones {
  align-self: start;
  display: grid;
  gap: 8px;
}

.zone-chip {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.zone-chip span {
  font-weight: 900;
}

.zone-chip small {
  color: var(--muted);
}

.zone-chip.is-active {
  border-color: var(--accent);
  background: #e9f5f3;
}

.mapping-section {
  margin-top: 34px;
}

.mapping-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.mapping-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.mapping-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mapping-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.mapping-grid th,
.mapping-grid td {
  min-width: 118px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  text-align: left;
}

.mapping-grid th {
  position: sticky;
  z-index: 2;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mapping-grid thead th {
  top: 0;
  padding: 9px 10px;
}

.mapping-grid tbody th {
  left: 0;
  min-width: 120px;
  padding: 9px 10px;
}

.mapping-grid thead th:first-child {
  left: 0;
  z-index: 3;
}

.mapping-cell {
  display: grid;
  align-content: start;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  border: 0;
  background: #fff;
  color: var(--ink);
  padding: 8px;
  text-align: left;
  font: inherit;
}

.mapping-cell strong {
  font-size: 0.95rem;
}

.mapping-cell span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.mapping-cell.is-highlighted {
  background: #e9f5f3;
  outline: 2px solid rgba(15, 118, 110, 0.28);
  outline-offset: -2px;
}

.mapping-cell.is-empty {
  color: #aaa39a;
}

.source-mapping-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.source-mapping-item {
  display: grid;
  gap: 3px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.source-mapping-item strong {
  text-transform: capitalize;
}

.source-mapping-item span {
  font-weight: 900;
}

.source-mapping-item small {
  color: var(--muted);
  font-weight: 800;
}

.source-mapping-item.is-highlighted {
  border-color: var(--accent);
  background: #e9f5f3;
}

.system-hero {
  display: grid;
  grid-template-columns: minmax(0, 920px);
}

.system-notes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.system-notes-revised { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.system-notes p + p, .system-authors-note p + p { margin-top: 0.85em; }
.system-authors-note { max-width: 78ch; margin: 30px 0; color: var(--muted); line-height: 1.65; }
.system-authors-note h2 { color: var(--ink); font-size: 1.1rem; }
.system-authors-note a, .system-notes a { text-underline-offset: 3px; }
.home-intro { max-width: 65ch; font-size: 1.08rem; line-height: 1.75; color: var(--muted); margin: 0 0 26px; }
.article-index, .article-page { max-width: 1100px; margin: 0 auto; }
.article-intro { max-width: 75ch; line-height: 1.65; color: var(--muted); }
.article-list { padding-left: 2rem; margin-top: 32px; }
.article-list li { padding: 14px 0 14px 12px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.article-list li::marker { color: var(--gold); font-weight: 700; }
.article-list a, .article-teaser-title { font-size: 1.1rem; font-weight: 650; }
.article-list a { text-underline-offset: 4px; }
.article-status { display: inline-block; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; margin-left: 10px; vertical-align: middle; }
.article-header { margin: 24px 0 40px; }
.article-page .article-header h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.12; max-width: 24ch; overflow-wrap: anywhere; }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 22px; color: var(--muted); font-size: .9rem; }
.article-meta .article-status { margin: 0; }
.article-body { max-width: 74ch; font-size: 1.08rem; line-height: 1.8; overflow-wrap: anywhere; }
.article-body > :first-child { margin-top: 0; }
.article-body p { margin: 0 0 1.2em; }
.article-body h2 { margin: 2.2em 0 .7em; line-height: 1.3; font-size: 1.5rem; }
.article-body h3, .article-body h4 { margin: 1.8em 0 .6em; line-height: 1.4; }
.article-body ul, .article-body ol { padding-left: 1.7em; margin: .8em 0 1.4em; }
.article-body li { padding-left: .2em; margin: .3em 0; }
.article-body li > p { margin: .4em 0; }
.article-body blockquote { margin: 1.5em 0; padding-left: 1.3em; border-left: 3px solid var(--accent); color: var(--muted); }
.article-body .players-designers {
  margin: 2.5em 0;
  padding: clamp(18px, 3vw, 30px);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(15, 118, 110, 0.055);
}
.article-body .players-designers > :first-child { margin-top: 0; }
.article-body .players-designers > :last-child { margin-bottom: 0; }
.article-body img { max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 8px; }
.article-body table { display: block; overflow-x: auto; border-collapse: collapse; max-width: 100%; margin: 1.5em 0; font-size: .95em; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.article-body th { background: var(--panel); }
.article-body pre { overflow-x: auto; background: var(--panel); padding: 16px; border-radius: 6px; }
.article-body a { color: var(--accent); text-underline-offset: 3px; }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.article-pagination { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 24px; align-items: start; border-top: 1px solid var(--line); margin-top: 60px; padding-top: 26px; line-height: 1.5; }
.article-pagination a { text-decoration: none; }
.article-pagination a:hover { text-decoration: underline; text-underline-offset: 4px; }
.article-pagination span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.article-previous { grid-column: 1; }
.article-all { grid-column: 2; }
.article-next { grid-column: 3; text-align: right; }
@media (max-width: 650px) {
  .navlinks { flex-wrap: wrap; }
  .article-pagination { grid-template-columns: 1fr; gap: 20px; }
  .article-pagination .article-previous, .article-pagination .article-all, .article-pagination .article-next { grid-column: 1; text-align: left; }
}

.system-notes article {
  border-top: 3px solid var(--accent);
  background: rgba(255, 253, 250, 0.58);
  padding: 14px 0 0;
}

.system-notes h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
}

.system-notes p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.system-groups {
  margin-top: 26px;
}

.system-groups > h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instance-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
}

.group-card {
  border-style: dashed;
  background: color-mix(in srgb, var(--panel) 88%, var(--accent) 12%);
}

.system-instance-art {
  display: grid;
  place-items: center;
  width: 58px;
  min-height: 58px;
}

.system-instance-art img {
  width: 58px;
  max-height: 58px;
  object-fit: contain;
}

.in-link-count-art {
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  gap: 2px;
}

.in-link-count-art img {
  width: 7px;
  max-height: 42px;
}

.partition-art {
  display: grid;
  align-content: center;
  gap: 2px;
}

.filter-action-visual .in-link-count-art img {
  width: 5px;
  max-height: 28px;
}

.filter-action-visual .partition-row {
  grid-template-columns: repeat(5, 8px);
}

.filter-action-visual .partition-row img {
  width: 8px;
  max-height: 8px;
}

.partition-row {
  display: grid;
  grid-template-columns: repeat(5, 10px);
  justify-content: center;
  gap: 1px;
}

.partition-row img {
  width: 10px;
  max-height: 10px;
}

.system-instance-ranks {
  grid-template-columns: 104px minmax(0, 1fr);
}

.system-instance-ranks .system-instance-art {
  grid-template-rows: 62px 34px;
  row-gap: 6px;
  align-self: center;
  justify-self: center;
  width: 104px;
  min-height: 102px;
}

.system-instance-ranks .system-instance-art img:first-child {
  order: 2;
  width: 34px;
  max-height: 34px;
}

.system-instance-ranks .system-instance-secondary {
  order: 1;
  width: 100px;
  max-height: 62px;
  clip-path: inset(12% 6% 12% 6%);
  object-fit: contain;
  transform: scale(1.32);
}

.system-text-glyph {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 900;
}

.system-border-mini {
  align-self: start;
  justify-self: center;
  width: 36px;
  height: 50px;
  margin-top: 4px;
}

.system-border-mini .top,
.system-border-mini .bottom {
  left: 9px;
  width: 16px;
  height: 8px;
}

.system-border-mini .left,
.system-border-mini .right {
  top: 17px;
  width: 8px;
  height: 16px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(0, 1fr);
  gap: clamp(24px, 6vw, 72px);
}

.detail-image img {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.glyph-link {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.glyph-link img {
  max-width: 38px;
  max-height: 38px;
  object-fit: contain;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 900;
}

@media (max-width: 1200px) {
  .cards-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .matrix-workspace {
    grid-template-columns: 1fr;
  }

  .mobile-sheet .selected-card {
    position: static;
    height: auto;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .mobile-sheet .selected-card > img {
    width: min(100%, 220px);
  }

  body:has(.mobile-sheet[open]) {
    overflow: hidden;
  }

  .mobile-sheet {
    position: fixed;
    inset: auto 0 0;
    box-sizing: border-box;
    width: min(100%, 640px);
    max-width: none;
    max-height: 90dvh;
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom);
    border: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    background: var(--panel);
    color: var(--ink);
    overscroll-behavior: contain;
  }

  .mobile-sheet::backdrop {
    background: rgb(0 0 0 / 45%);
  }

  .mobile-sheet-toolbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
}

@media (max-width: 760px) {
  body > header {
    position: sticky;
    top: 0;
    z-index: 25;
  }

  .topbar {
    position: static;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-height: 0;
    gap: 5px 10px;
    padding: 6px 10px;
  }

  .topbar .navlinks {
    gap: 4px;
    flex-wrap: wrap;
  }

  .topbar .navlinks a,
  .topbar .edition-option {
    padding: 6px;
    font-size: .8rem;
  }

  .topbar .edition-switch {
    width: auto;
  }

  .home,
  .detail,
  .workspace,
  .matrix-workspace {
    grid-template-columns: 1fr;
  }

  .matrix-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    padding: 14px;
  }

  .matrix-toolbar > div {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 12px;
  }

  .matrix-toolbar select {
    width: 100%;
  }

  .matrix-main {
    grid-template-rows: auto auto;
    align-content: start;
    height: auto;
    padding: 12px;
    overflow: visible;
  }

  .matrix-selected-card {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .matrix-scroll {
    max-height: 68vh;
  }

  .matrix-cell {
    min-height: 44px;
  }

  .matrix-phone-hint {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: .83rem;
  }

  .system-notes {
    grid-template-columns: 1fr;
  }

  .game-tools,
  .game-detail-layout,
  .game-detail-stats {
    grid-template-columns: 1fr;
  }

  .game-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mapping-heading {
    align-items: start;
    flex-direction: column;
  }

  .home {
    padding: 26px 18px;
  }

  .filters,
  .selected-card {
    position: static;
    height: auto;
    border: 0;
    background: transparent;
  }

  .card-results {
    display: block;
    height: auto;
    max-height: none;
    padding: 12px;
    overflow: visible;
  }

  .filters {
    max-height: none;
    overflow: visible;
    padding: 14px;
  }

  .filters h1,
  .filters .matrix-link,
  .cards-workspace .table-wrap {
    display: none;
  }

  .filters input,
  .filters select,
  .more-filters summary {
    min-height: 40px;
  }

  .cards-phone-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .cards-phone-toolbar h1 {
    margin: 0 auto 0 0;
    font-size: 1.55rem;
  }

  .cards-workspace .results-bar {
    margin: 8px 0;
  }

  .cards-workspace .thumb-scroll,
  .mobile-sheet .thumb-scroll {
    max-height: none;
    overflow: visible;
    border: 0;
    padding: 3px;
    background: transparent;
  }

  .cards-workspace .thumb-grid,
  .mobile-sheet .thumb-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 8px;
  }

  .filter-sheet-footer {
    display: block;
    position: sticky;
    bottom: 0;
    margin-top: 12px;
    padding: 8px 0;
    background: var(--panel);
  }

  .filter-sheet-footer button {
    width: 100%;
  }

  .mobile-sheet .matrix-results {
    padding: 12px;
  }
}

@media (min-width: 1320px) {
  .system-instance-grid-ranks {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
