
    .periodic-content {
      --gap: 1px;
      --cell-bg: #eee;
      --cell-fg: #111;
      --muted: 0.2;
    }

    .periodic-content {
      margin: 0;
      font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
      color: #111;
      background: #fafafa;
      padding: 16px;
      display: grid;
      gap: 16px;
    }

    /* ---------- Filters (CSS-only) ---------- */
    .periodic-content fieldset {
      border: 1px solid #ddd;
      border-radius: 10px;
      padding: 12px 12px 10px;
      background: #fff;
      display: grid;
      gap: 8px;
      max-width: 1100px;
    }
    .periodic-content fieldset > div {
      display: flex;
      flex-wrap: wrap;
      gap: 10px 14px;
      align-items: center;
    }
    .periodic-content label { cursor: pointer; user-select: none; }
    .periodic-content input[type="radio"] { transform: translateY(1px); }

    /* One rule per filter (still no JS) */
    .periodic-content:has(#all:checked) li { opacity: 1; }
    .periodic-content:has(#alk:checked) li:not(.alk) { opacity: var(--muted); }
    .periodic-content:has(#aem:checked) li:not(.aem) { opacity: var(--muted); }
    .periodic-content:has(#trn:checked) li:not(.trn) { opacity: var(--muted); }
    .periodic-content:has(#pst:checked) li:not(.pst) { opacity: var(--muted); }
    .periodic-content:has(#nmt:checked) li:not(.nmt) { opacity: var(--muted); }
    .periodic-content:has(#met:checked) li:not(.met) { opacity: var(--muted); }
    .periodic-content:has(#hlg:checked) li:not(.hlg) { opacity: var(--muted); }
    .periodic-content:has(#nbl:checked) li:not(.nbl) { opacity: var(--muted); }
    .periodic-content:has(#lan:checked) li:not(.lan) { opacity: var(--muted); }
    .periodic-content:has(#act:checked) li:not(.act) { opacity: var(--muted); }

    /* ---------- Table grid ---------- */
    .periodic-content ol {
      all: unset;
      counter-reset: element;
      display: grid;
      gap: var(--gap);

      /* 18 columns × 10 rows */
      grid-template-columns: repeat(18, minmax(0, 1fr));
      grid-template-rows: repeat(10, minmax(0, 1fr));

      /* Responsive sizing */
      max-width: 1100px;
      width: 100%;
      margin: 0;
      container-type: inline-size;
      font-size: clamp(10px, 2cqi, 18px);
    }

    .periodic-content li {
      list-style: none;
      aspect-ratio: 1 / 1;
      background: var(--cell-bg);
      color: var(--cell-fg);
      padding: 0.35ch;
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-template-rows: 1fr 1fr 1fr;
      border-radius: 3px;
      transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;

      counter-increment: element;
    }

    .periodic-content li:hover {
      transform: scale(1.06);
      filter: brightness(1.02);
      z-index: 2;
    }

    .periodic-content li::before {
      content: counter(element);
      font-size: 0.33em;
      align-self: start;
      justify-self: start;
    }

    .periodic-content li::after {
      content: attr(data-mass);
      font-size: 0.33em;
      grid-area: 1 / 2 / 2 / 3;
      align-self: start;
      justify-self: end;
      opacity: 0.85;
    }

    .periodic-content abbr {
      grid-area: 2 / 1 / 4 / 3;
      align-self: center;
      justify-self: center;
      font-weight: 700;
      text-decoration: none;
      font-size: 1em;
      letter-spacing: 0.02em;
    }

    /* ---------- Category colors (simple palette) ---------- */
    .periodic-content .alk { --cell-bg: #ffd6d6; } /* Alkali metals */
    .periodic-content .aem { --cell-bg: #ffe6c7; } /* Alkaline earth metals */
    .periodic-content .trn { --cell-bg: #d9f0ff; } /* Transition metals */
    .periodic-content .pst { --cell-bg: #e6e6ff; } /* Post-transition metals */
    .periodic-content .met { --cell-bg: #dff7df; } /* Metalloids */
    .periodic-content .nmt { --cell-bg: #f2ffd9; } /* Nonmetals */
    .periodic-content .hlg { --cell-bg: #fff2b8; } /* Halogens */
    .periodic-content .nbl { --cell-bg: #e5d7ff; } /* Noble gases */
    .periodic-content .lan { --cell-bg: #d7fff2; } /* Lanthanides */
    .periodic-content .act { --cell-bg: #ffd7f2; } /* Actinides */

    /* ---------- Grid "magic" to match the periodic table ---------- */
    /* Helium to last column */
    .periodic-content li:nth-child(2) { grid-column: 18; }

    /* Boron + Aluminum to column 13 */
    .periodic-content li:nth-child(5), .periodic-content li:nth-child(13) { grid-column: 13; }

    /* Lanthanides row (row 9), columns 4–17: elements 58–71 */
    .periodic-content li:nth-child(58) { grid-area: 9 / 4 / 10 / 5; }
    .periodic-content li:nth-child(59) { grid-area: 9 / 5 / 10 / 6; }
    .periodic-content li:nth-child(60) { grid-area: 9 / 6 / 10 / 7; }
    .periodic-content li:nth-child(61) { grid-area: 9 / 7 / 10 / 8; }
    .periodic-content li:nth-child(62) { grid-area: 9 / 8 / 10 / 9; }
    .periodic-content li:nth-child(63) { grid-area: 9 / 9 / 10 / 10; }
    .periodic-content li:nth-child(64) { grid-area: 9 / 10 / 10 / 11; }
    .periodic-content li:nth-child(65) { grid-area: 9 / 11 / 10 / 12; }
    .periodic-content li:nth-child(66) { grid-area: 9 / 12 / 10 / 13; }
    .periodic-content li:nth-child(67) { grid-area: 9 / 13 / 10 / 14; }
    .periodic-content li:nth-child(68) { grid-area: 9 / 14 / 10 / 15; }
    .periodic-content li:nth-child(69) { grid-area: 9 / 15 / 10 / 16; }
    .periodic-content li:nth-child(70) { grid-area: 9 / 16 / 10 / 17; }
    .periodic-content li:nth-child(71) { grid-area: 9 / 17 / 10 / 18; }

    /* Actinides row (row 10), columns 4–17: elements 90–103 */
    .periodic-content li:nth-child(90) { grid-area: 10 / 4 / 11 / 5; }
    .periodic-content li:nth-child(91) { grid-area: 10 / 5 / 11 / 6; }
    .periodic-content li:nth-child(92) { grid-area: 10 / 6 / 11 / 7; }
    .periodic-content li:nth-child(93) { grid-area: 10 / 7 / 11 / 8; }
    .periodic-content li:nth-child(94) { grid-area: 10 / 8 / 11 / 9; }
    .periodic-content li:nth-child(95) { grid-area: 10 / 9 / 11 / 10; }
    .periodic-content li:nth-child(96) { grid-area: 10 / 10 / 11 / 11; }
    .periodic-content li:nth-child(97) { grid-area: 10 / 11 / 11 / 12; }
    .periodic-content li:nth-child(98) { grid-area: 10 / 12 / 11 / 13; }
    .periodic-content li:nth-child(99) { grid-area: 10 / 13 / 11 / 14; }
    .periodic-content li:nth-child(100) { grid-area: 10 / 14 / 11 / 15; }
    .periodic-content li:nth-child(101) { grid-area: 10 / 15 / 11 / 16; }
    .periodic-content li:nth-child(102) { grid-area: 10 / 16 / 11 / 17; }
    .periodic-content li:nth-child(103) { grid-area: 10 / 17 / 11 / 18; }
  
.periodic-content{padding:0;background:transparent;display:block}.periodic-content fieldset{max-width:none;padding:24px;margin-bottom:30px;border-color:var(--line);border-radius:16px}.periodic-content legend{font-weight:600;padding:0 8px}.periodic-content ol{width:100%;min-width:850px;max-width:none;gap:4px;font-size:20px}.periodic-content li{border-radius:8px;min-height:44px}.periodic-content abbr{font-family:var(--font-heading)}.periodic-content li::before,.periodic-content li::after{font-size:11px}.periodic-scroll{overflow-x:auto;padding:8px 0 20px}.periodic-content fieldset>div{gap:12px 18px}.periodic-content label{font-size:14px}.periodic-content .alk{--cell-bg:#efc5bb}.periodic-content .aem{--cell-bg:#eedac5}.periodic-content .trn{--cell-bg:#d6e1eb}.periodic-content .pst{--cell-bg:#d7d8e5}.periodic-content .nmt{--cell-bg:#dae2c9}.periodic-content .nbl{--cell-bg:#e1d9e5}