/* Periodic Table's own look, after the shell every tool shares (../shell/shell.css: the brand, the name card, the score,
   the list down the left, the settings and their "i", the windows, the result, the phone layout, and the wide middle
   column every trainer has). Only this tool's subject goes here: never restyle one of the shell's pieces (a change to
   one of them is made in shell.css, for every tool). Colours and fonts are the shell's variables (--fg, --muted, --ok…). */

/* the subject, in the middle column under the name card: the table, and a line about the element under it, on the
   framed board every trainer has */
.board {
  flex: 1; min-width: 0; min-height: 0; box-sizing: border-box; position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 18px 20px 14px;
  background: radial-gradient(80% 60% at 50% 30%, #13222c 0%, #0c141b 72%);
  border: 1px solid var(--line-strong); border-radius: 18px;
}

/* The table keeps its own order in every language (it reads left to right in Arabic and Hebrew too), and draws each cell
   from the table's width (--cell), so it fits any column. On a phone it can be drawn wider and scrolled (the zoom button). */
.tablewrap { width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; direction: ltr; }
.tablesize { width: 100%; container-type: inline-size; }
.tablewrap.zoomed .tablesize { width: 680px; }
.ptable {
  --cell: calc((100cqi - 17 * var(--gap)) / 18); --gap: max(2px, 0.35cqi);
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, auto) calc(var(--cell) * .28) repeat(2, auto);
  gap: var(--gap); width: 100%;
}
.el {
  position: relative; aspect-ratio: 1 / 1.08; min-width: 0; padding: 0; display: grid; place-items: center;
  font: inherit; color: var(--fg); background: var(--bg-lift); border: 1px solid var(--line); border-radius: max(2px, calc(var(--cell) * .08));
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background-color .15s, border-color .15s, opacity .15s;
}
.el .num { position: absolute; top: 6%; inset-inline-start: 8%; font: 500 calc(var(--cell) * .21)/1 var(--f-mono); color: var(--muted); }
.el .sym { font: 700 calc(var(--cell) * .42)/1 var(--f-display); margin-top: 12%; letter-spacing: -.01em; }
.el:hover { border-color: var(--line-strong); }
.el:focus-visible { outline: 2px solid var(--scan); outline-offset: 1px; }
.marker { display: grid; place-items: center; border: 1px dashed var(--line); border-radius: max(2px, calc(var(--cell) * .08)); color: var(--muted); font: 500 calc(var(--cell) * .2)/1.1 var(--f-mono); text-align: center; aspect-ratio: 1 / 1.08; }

/* colours by kind of element (the Colors row): a tint of each, so the symbols stay easy to read */
.ptable.colours .el { background: color-mix(in srgb, var(--k) 20%, var(--bg-lift)); border-color: color-mix(in srgb, var(--k) 45%, var(--bg-lift)); }
.ptable.colours .el .num { color: color-mix(in srgb, var(--k) 55%, var(--fg)); }
.el[data-kind="alkali"] { --k: #ff8a65; }
.el[data-kind="alkaline"] { --k: #ffc15e; }
.el[data-kind="transition"] { --k: #6fa8dc; }
.el[data-kind="post"] { --k: #8fb3a3; }
.el[data-kind="metalloid"] { --k: #b5c96a; }
.el[data-kind="nonmetal"] { --k: #6fd0a0; }
.el[data-kind="halogen"] { --k: #e6e36b; }
.el[data-kind="noble"] { --k: #c59cf0; }
.el[data-kind="lanthanide"] { --k: #e98bb4; }
.el[data-kind="actinide"] { --k: #d77a7a; }
.kdot { display: inline-block; width: .62em; height: .62em; border-radius: 50%; background: var(--k); margin-inline-end: .45em; vertical-align: .05em; }

/* what a cell shows: dimmed outside the set being learned, blank in a question that would give the answer away */
.el.is-dim { opacity: .25; }
.el.is-blank .num, .el.is-blank .sym { visibility: hidden; }
.el.is-target { border-color: var(--bone); box-shadow: 0 0 0 2px var(--bone); z-index: 1; }
.el.is-sel { border-color: var(--scan); box-shadow: 0 0 0 2px var(--scan); z-index: 1; }
.el.is-found { background: color-mix(in srgb, var(--ok) 26%, var(--bg-lift)); border-color: var(--ok); }
.el.is-ok { background: color-mix(in srgb, var(--ok) 34%, var(--bg-lift)); border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); z-index: 1; }
.el.is-bad { background: color-mix(in srgb, var(--bad) 30%, var(--bg-lift)); border-color: var(--bad); z-index: 1; }
.el.is-bad.is-blank .num, .el.is-bad.is-blank .sym, .el.is-ok.is-blank .num, .el.is-ok.is-blank .sym { visibility: visible; }

/* the zoom button (only where the table is drawn small: a phone) and the line under the table */
.zoombtn { display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; padding: 6px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--bg-lift); color: var(--muted); cursor: pointer; z-index: 2; }
.zoombtn svg { width: 100%; height: 100%; }
.zoombtn[aria-pressed="true"] { color: var(--bone); border-color: var(--bone); }
.info { margin: 0; min-height: 3.1em; max-width: 72ch; align-self: center; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.45; }
.info:empty { visibility: hidden; }

/* the answers under it: four to pick from, or a box to type in */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; width: min(100%, 640px); }
.actions .btn.is-ok { border-color: var(--ok); color: var(--ok); }
.actions .btn.is-bad { border-color: var(--bad); color: var(--bad); }
.actions .btn kbd { margin-inline-end: 6px; }
.typebox { grid-column: 1 / -1; display: flex; gap: 6px; }
.typebox input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 600; color: var(--fg); background: var(--bg-lift);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 13px; outline: none;
}
.typebox input:focus { border-color: var(--scan); }
.typebox .btn { flex: none; }

@media (max-width: 760px) {
  .board { padding: 52px 8px 10px; border-radius: 14px; }
  .zoombtn { display: block; }
  .info { font-size: 13px; min-height: 2.9em; }
}
.actions .btn.primary { background: var(--bone); }   /* (under the subject the shell gives every button the panel's background: the main one keeps its own, as in Sign Language) */
