/* Self-hosted so the page works behind school web filters.
   Variable font, SIL Open Font License, latin subset. */
@font-face {
  font-family: 'Baloo 2';
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/baloo2.woff2) format('woff2');
}

:root { --ink: #1d1a17; --green: #3d7a4a; --red: #b03a2e; --blue: #2f6db3; --line: #d9d4cc; }
* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px; background: #f6f3ee; color: var(--ink);
  font-family: 'Baloo 2', system-ui, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
[hidden] { display: none !important; }

header { max-width: 1000px; margin: 0 auto 12px; }
header h1 { margin: 0; font-size: 2.2rem; line-height: 1.1; }
header p { margin: 4px 0 0; color: #555; }
.home { color: #666; font-weight: 700; text-decoration: none; }

main {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 16px 20px;
  grid-template-areas: "side work" "answer work";
  max-width: 1000px; margin: 0 auto;
}
#side, #work, #answer { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 16px; }
#side { grid-area: side; }
#work { grid-area: work; }
#answer { grid-area: answer; align-self: start; }

/* The element, drawn like a square on the periodic table */
#card {
  display: grid; justify-items: center; padding: 10px 12px 14px;
  border: 3px solid var(--ink); border-radius: 12px; background: #fdf6dc;
}
#z { justify-self: start; font-size: 1.6rem; font-weight: 800; line-height: 1; }
#symbol { font-size: 4.2rem; line-height: 1; font-weight: 800; }
#name { font-size: 1.5rem; font-weight: 700; }
#mass { color: #555; }

#score { margin: 12px 0 0; font-weight: 700; color: #555; }
#score:empty { display: none; }

#settings { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 10px; }
#settings summary { font-weight: 800; cursor: pointer; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-weight: 800; margin-bottom: 4px; }
.field select { width: 100%; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; }
.check { display: flex; gap: 8px; align-items: baseline; line-height: 1.25; cursor: pointer; }

#atom { display: block; width: 100%; max-width: 460px; margin: 0 auto; touch-action: manipulation; user-select: none; }
#atom text { font-family: Arial, Helvetica, sans-serif; font-size: 22px; text-anchor: middle; pointer-events: none; }
#atom .sym { font-size: 30px; font-weight: bold; }
#atom .tip { font-size: 18px; fill: #777; }
#atom .nucleus { fill: #e6e6e6; stroke: var(--ink); stroke-width: 2.5; }
#atom .hit { fill: none; stroke: transparent; cursor: pointer; pointer-events: stroke; }
#atom .ring { fill: none; stroke: var(--ink); stroke-width: 2.5; pointer-events: none; }
#atom .shell:hover .ring { stroke: var(--blue); stroke-width: 5; }
#atom .electron { fill: var(--blue); stroke: #fff; stroke-width: 3; cursor: pointer; }
#atom .electron:hover { fill: var(--red); }
#atom.done .hit, #atom.done .electron { pointer-events: none; }

#nucleus { display: flex; justify-content: center; gap: 16px; margin-top: 8px; font-weight: 700; }
#nucleus input { width: 4.5em; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 8px; }

#shell-list {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  list-style: none; padding: 0; margin: 12px 0 0;
}
#shell-list li {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 2px solid var(--line); border-radius: 10px;
}
#shell-list span { font-weight: 700; color: #555; margin-right: 2px; }
#shell-list b { min-width: 1.4em; text-align: center; font-size: 1.3rem; }
#shell-list button { width: 34px; height: 34px; padding: 0; border: 2px solid var(--ink); border-radius: 8px; background: #fff; font-weight: 800; font-size: 1.2rem; }

.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.tools button, .actions button {
  padding: 6px 14px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; font-weight: 700;
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.actions button { font-size: 1.2rem; padding: 8px 22px; }
.actions .primary { background: var(--green); color: #fff; box-shadow: 3px 3px 0 var(--ink); }

#feedback { margin: 12px 0 0; text-align: center; font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
#feedback:empty { display: none; }
#feedback.right { color: var(--green); }
#feedback.wrong { color: var(--red); }
#feedback.shown { color: var(--blue); }

@media (max-width: 760px) {
  body { padding: 12px; }
  main { grid-template-columns: 1fr; grid-template-areas: "side" "work" "answer"; }
  #symbol { font-size: 3.5rem; }
}
