:root { --green-light: #d0f0d0; --green-dark: #080; --red-light: #f8d0d0; --grey: #ccc; --text-on-light: #000; --text-on-dark: #fff; } .toolbar { display: flex; gap: 0.5em; justify-content: end; } table { background: var(--red-light); color: var(--text-on-light); border-spacing: 0; margin-block-end: 0.2em; } th, td { position: relative; border: 1px solid #fff; min-inline-size: 2.4em; line-height: 1.8; text-align: center; font-weight: normal; } th:first-child { text-align: right; } td.disabled { background-color: var(--grey); } table input { appearance: none; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: 0; cursor: pointer; } table input:focus-visible { outline: 2px solid; z-index: 1; } .inherit-allow { background: var(--green-light); } table input:checked { background: var(--green-dark); } table input ~ span { pointer-events: none; position: relative; z-index: 1; } table input:checked ~ span { color: var(--text-on-dark); } @media (prefers-color-scheme: dark) { :root { color-scheme: dark; } }