:root {
  --main-bg-color: white;
}

body {
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  color: #444;
  padding: 20px;
}
table {
  border-collapse: collapse;
  margin-bottom: 40px;
}
th,
td {
  border: 1px solid #ccc;
  padding: 5px 10px;
  text-align: left;
}
th {
  background-color: #f9f9f9;
}

/* Dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --main-bg-color: #0d1117;
  }

  body {
    color: #c9d1d9;
    background: var(--main-bg-color);
  }

  th,
  td {
    border-color: #555;
  }

  th {
    background-color: #090909;
  }

  a:link {
    color: #58a6ff;
  }

  a:visited {
    color: #8e96f0;
  }
}

/* Sticky first row */
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Sticky first column */
thead th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  background-color: var(--main-bg-color); /* so text doesn't overlap under it */
  z-index: 2;
}

thead tr:first-child th:first-child {
  z-index: 3;
}

/* Buttons to hide furigana/pinyin */
thead tr.languages th[lang] div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.hide-ja-ruby td[lang="ja"] rt,
body.hide-zh-ruby td[lang="zh"] rt,
body.hide-zh-ruby td[lang="zh"] span.whitespace {
  display: none;
}
