/* The interactive periodic table (js/ptable.js) and its element card */
.cat-alkali          { --pc: #ff8a80; }
.cat-alkaline        { --pc: #ffb84d; }
.cat-transition      { --pc: #d6b3ff; }
.cat-post-transition { --pc: #6ee7c8; }
.cat-metalloid       { --pc: #8ee69a; }
.cat-nonmetal        { --pc: #d4f25a; }
.cat-halogen         { --pc: #ff9ad5; }
.cat-noble           { --pc: #ffe14d; }
.cat-lanthanide      { --pc: #9fd3ff; }
.cat-actinide        { --pc: #ffc9a8; }

.pt { margin: 8px 0 34px; }
.pt-wrap {
  background: var(--wall-deep);
  border-radius: 18px;
  padding: 16px 10px 14px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(255, 248, 236, .08);
}
.pt-top { padding: 0 6px; }
.pt-title { margin: 0; font-family: "Permanent Marker", cursive; font-weight: 400; font-size: 26px; color: var(--jot); }
.pt-sub { margin: 2px 0 10px; color: var(--chalk-dim); font-size: 14px; }

.pt-tabs { display: flex; gap: 6px; padding: 0 4px 10px; overflow-x: auto; scrollbar-width: none; }
.pt-tab {
  flex: 1 0 auto;
  font: 700 14px/1 inherit;
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 248, 236, .1);
  color: var(--chalk);
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s var(--spring);
}
.pt-tab.on { background: var(--jot); color: var(--ink); transform: rotate(-2deg) scale(1.04); }

.pt-panel-top { padding: 0 6px; min-height: 8px; }
.pt-blurb, .pt-tip { color: var(--chalk-dim); font-size: 14px; margin: 0 0 10px; line-height: 1.45; }
.pt-tip:empty { display: none; }

/* the grid: 18 columns that always fit the phone's width */
.pt-grid-box { position: relative; }
.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto) 8px auto auto;
  gap: 2px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.pt-cell {
  position: relative;
  aspect-ratio: 1 / 1.18;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--pc);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pt-in .45s var(--spring) both;
  animation-delay: calc(var(--i) * 6ms);
  transition: opacity .3s, transform .25s var(--spring), background-color .35s, filter .3s;
  -webkit-tap-highlight-color: transparent;
}
@keyframes pt-in { from { transform: scale(.2) rotate(-25deg); opacity: 0; } }
.pt-cell-n { display: none; font-size: 7px; line-height: 1; opacity: .7; }
.pt-cell-sym { font-weight: 800; font-size: clamp(8.5px, 2.6vw, 17px); line-height: 1; letter-spacing: -.02em; }
@media (min-width: 560px) { .pt-cell-n { display: block; } .pt-grid { gap: 3px; } }
.pt-cell.seen::after {
  content: "";
  position: absolute;
  top: 2px; right: 2px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ink);
  opacity: .45;
}
.pt-cell:focus-visible { outline: 2px solid var(--chalk); outline-offset: 1px; z-index: 2; }
.pt-cell.peek { transform: scale(1.25); z-index: 3; box-shadow: 0 0 0 2px var(--chalk); }
.pt-cell.dim { opacity: .18; transform: scale(.88); }
.pt-cell.ping { animation: pt-ping 1s ease-out 2; z-index: 3; }
@keyframes pt-ping { 0%, 100% { transform: none; box-shadow: none; } 40% { transform: scale(1.6); box-shadow: 0 0 0 4px var(--chalk); } }
.pt-gap {
  font-size: 6.5px;
  color: var(--chalk-dim);
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(255, 248, 236, .25);
  border-radius: 3px;
  text-align: center;
  line-height: 1;
}
@media (min-width: 560px) { .pt-gap { font-size: 9px; } }

/* the loupe that follows a finger */
.pt-loupe {
  position: absolute;
  z-index: 5;
  width: 78px;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--pc);
  color: var(--ink);
  border-radius: 12px;
  padding: 6px 4px 7px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35), 0 0 0 2px var(--chalk);
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center;
}
.pt-loupe[hidden] { display: none; }
.pt-loupe-n { font-size: 11px; font-weight: 700; opacity: .7; }
.pt-loupe-sym { font-size: 32px; font-weight: 800; line-height: 1; }
.pt-loupe-name { font-size: 11px; font-weight: 700; margin-top: 2px; }

.pt-legend { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 4px 0; }
.pt-key {
  font: 700 12px/1 inherit;
  font-family: inherit;
  padding: 7px 10px;
  border-radius: 999px;
  border: 0;
  background: var(--pc);
  color: var(--ink);
  cursor: pointer;
  transition: transform .2s var(--spring), box-shadow .2s;
}
.pt-key.on { transform: scale(1.08) rotate(-2deg); box-shadow: 0 0 0 2px var(--chalk); }
.pt-legend .pt-tip { flex-basis: 100%; margin: 6px 2px 0; color: var(--chalk); }
.pt-seen { margin: 10px 6px 0; font-size: 12px; color: var(--chalk-dim); }

/* Heat it */
.pt-temp { margin: 0; font-weight: 800; font-size: 22px; color: var(--chalk); font-variant-numeric: tabular-nums; }
.pt-slider { width: 100%; margin: 8px 0 6px; accent-color: #ff6b4a; height: 28px; }
.pt-marks { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pt-mark {
  flex: none;
  font: 600 12px/1 inherit; font-family: inherit;
  padding: 7px 9px; border-radius: 999px; border: 1px solid rgba(255, 248, 236, .25);
  background: transparent; color: var(--chalk); cursor: pointer;
}
.pt-count { margin: 6px 0 10px; color: var(--chalk-dim); font-size: 13px; }
.st-key { cursor: default; }
.pt-key.st-solid  { background: #d6b3ff; }
.pt-key.st-liquid { background: #4fb3ff; }
.pt-key.st-gas    { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 1.5px var(--chalk); }
.pt-key.st-unknown { background: repeating-linear-gradient(45deg, #6b6290 0 4px, #554d78 4px 8px); color: var(--chalk); }
.pt-cell.st-solid { background: #d6b3ff; }
.pt-cell.st-liquid {
  background: linear-gradient(180deg, #8fd0ff 0 30%, #3a9cf0 30% 100%);
  background-size: 100% 200%;
  animation: pt-slosh 1.4s ease-in-out infinite alternate;
}
@keyframes pt-slosh { from { background-position: 0 0; } to { background-position: 0 12%; } }
.pt-cell.st-gas {
  background: rgba(255, 248, 236, .06);
  color: var(--chalk);
  box-shadow: inset 0 0 0 1px rgba(255, 248, 236, .55);
  animation: pt-float 2.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * -97ms);
}
@keyframes pt-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px) rotate(3deg); } }
.pt-cell.st-unknown { background: repeating-linear-gradient(45deg, #6b6290 0 3px, #554d78 3px 6px); color: var(--chalk); }

/* Discovery */
.pt-cell.hidden-yet { opacity: .08; transform: scale(.7); }
.pt-cell.new { animation: pt-pop .6s var(--spring); box-shadow: 0 0 0 2px var(--chalk); z-index: 3; }
@keyframes pt-pop { from { transform: scale(2.2); } }
.pt-news { min-height: 2.9em; margin: 0 0 8px; color: var(--chalk); font-size: 14px; line-height: 1.4; }
.pt-play, .pt-next, .pt-start {
  font: 800 15px/1.1 inherit; font-family: inherit;
  padding: 11px 16px; border-radius: 12px; border: 0;
  background: var(--jot); color: var(--ink); cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.pt-play:active, .pt-next:active, .pt-start:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.pt-play { margin-bottom: 10px; }

/* Find it */
.pt-game-intro { display: grid; gap: 10px; margin-bottom: 12px; }
.pt-start { text-align: left; display: grid; gap: 4px; }
.pt-start:nth-of-type(2) { background: #ff9ad5; }
.pt-start-sub { font-weight: 500; font-size: 13px; }
.pt-q {
  background: var(--jot); color: var(--ink);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
  transform: rotate(-.6deg);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .22);
  min-height: 96px;
}
.pt-q p { margin: 0; }
.pt-q-count { font-size: 12px; font-weight: 700; opacity: .6; }
.pt-q-text { font-family: "Permanent Marker", cursive; font-size: 26px; line-height: 1.15; margin-top: 4px !important; }
.pt-q-lead { font-weight: 800; margin-top: 4px !important; }
.pt-q-clue { font-size: 15px; line-height: 1.4; margin-top: 2px !important; }
.pt-q-hint { font-size: 13px; color: #a3002f; margin-top: 6px !important; font-weight: 700; }
.pt-q-hint:empty { display: none; }
.pt-q-verdict { font-weight: 800; font-size: 17px; margin-top: 4px !important; }
.pt-q-verdict.yes { color: #0b6b2e; }
.pt-q-verdict.no { color: #a3002f; }
.pt-q-fact { font-size: 14px; line-height: 1.45; margin-top: 6px !important; }
.pt-q-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.pt-q .pt-next { background: var(--ink); color: var(--jot); }
.pt-cell.right { animation: pt-yes .6s var(--spring); box-shadow: 0 0 0 3px #26d36b; z-index: 3; transform: scale(1.3); }
@keyframes pt-yes { from { transform: scale(2) rotate(20deg); } }
.pt-cell.wrong { animation: pt-no .4s; box-shadow: 0 0 0 2px #ff3b5c; }
@keyframes pt-no { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.pt-cell.hit { box-shadow: 0 0 0 3px var(--chalk); z-index: 3; }

/* ---------- the element card ---------- */
html.pt-locked { overflow: hidden; }
.pt-sheet { position: fixed; inset: 0; z-index: 60; }
.pt-sheet[hidden] { display: none; }
.pt-scrim { position: absolute; inset: 0; background: rgba(13, 7, 38, .6); opacity: 0; transition: opacity .25s; }
.pt-sheet.open .pt-scrim { opacity: 1; }
.pt-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--chalk); color: var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.05);
  max-width: 640px; margin: 0 auto;
}
.pt-sheet.open .pt-panel { transform: none; }
.pt-grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(28, 20, 64, .2); margin: 0 auto 8px; }
.pt-x {
  position: absolute; top: 10px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(28, 20, 64, .08); color: var(--ink);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.pt-sheet-body.from-right { animation: pt-slide-r .3s ease-out; }
.pt-sheet-body.from-left { animation: pt-slide-l .3s ease-out; }
@keyframes pt-slide-r { from { transform: translateX(40px); opacity: 0; } }
@keyframes pt-slide-l { from { transform: translateX(-40px); opacity: 0; } }

.pt-head { display: flex; gap: 14px; align-items: center; margin: 4px 40px 12px 0; }
.pt-tile {
  flex: none;
  width: 96px; height: 108px;
  background: var(--pc);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 rgba(28, 20, 64, .2);
  transform: rotate(-3deg);
  animation: pt-tile-in .5s var(--spring);
}
@keyframes pt-tile-in { from { transform: rotate(-20deg) scale(.5); } }
.pt-tile-n { font-weight: 700; font-size: 14px; opacity: .7; }
.pt-tile-sym { font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.03em; }
.pt-tile-mass { font-size: 12px; opacity: .7; margin-top: 2px; }
.pt-name { margin: 0; font-family: "Permanent Marker", cursive; font-weight: 400; font-size: 30px; line-height: 1.05; }
.pt-cat { margin: 4px 0 0; font-weight: 800; font-size: 14px; }
.pt-cat::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); margin-right: 6px; box-shadow: 0 0 0 1px rgba(28, 20, 64, .3); }
.pt-where { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }

.pt-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pt-pill { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; background: rgba(28, 20, 64, .08); }
.pt-pill.st-gas { background: #e6f4ff; }
.pt-pill.st-liquid { background: #bfe3ff; }

.pt-fact {
  margin: 0 0 12px;
  background: var(--jot);
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 16px; line-height: 1.45; font-weight: 600;
  transform: rotate(.6deg);
  box-shadow: 0 4px 0 rgba(28, 20, 64, .15);
}

.pt-atom-box { display: flex; gap: 12px; align-items: center; margin: 6px 0 12px; }
.pt-atom { flex: none; width: 132px; height: 132px; overflow: visible; }
.pt-orbit { fill: none; stroke: rgba(28, 20, 64, .18); stroke-width: 1; }
.pt-shell { transform-origin: 0 0; animation: pt-spin linear infinite; }
@keyframes pt-spin { to { transform: rotate(360deg); } }
.pt-e { fill: var(--ink); animation: pt-e-in .4s var(--spring) both; transform-box: fill-box; transform-origin: center; }
.pt-e-out { fill: #ff4f6d; }
@keyframes pt-e-in { from { transform: scale(0); } }
.pt-nucleus { fill: #ff8a3d; stroke: var(--ink); stroke-width: 1.5; }
.pt-nucleus-n { font-size: 10px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.pt-shells p { margin: 0; }
.pt-shells-n { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.pt-shells-cap { font-size: 11px; color: var(--ink-soft); }
.pt-shells-story { font-size: 14px; line-height: 1.4; margin-top: 6px !important; }
@media (prefers-reduced-motion: reduce) {
  .pt-shell, .pt-cell.st-gas, .pt-cell.st-liquid, .pt-cell { animation: none !important; }
}

.pt-row { margin: 0 0 9px; font-size: 15px; line-height: 1.45; }
.pt-row-label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.pt-show {
  display: block; width: 100%; margin: 8px 0 4px;
  font: 700 14px/1 inherit; font-family: inherit;
  padding: 11px; border-radius: 10px; border: 2px solid var(--ink);
  background: transparent; color: var(--ink); cursor: pointer;
}
.pt-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid rgba(28, 20, 64, .12); margin-top: 8px; }
.pt-nav button {
  flex: 1;
  font: 700 15px/1 inherit; font-family: inherit;
  padding: 12px; border-radius: 12px;
  border: 2px solid rgba(28, 20, 64, .2); background: transparent; color: var(--ink); cursor: pointer;
}
.pt-nav button:active { background: rgba(28, 20, 64, .08); }

/* puzzles.html: element keys that open a card, a fact line, and tiles on the done screen */
.sud-legend.is-elements { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.sud-legend li.key-el { cursor: pointer; align-items: center; box-shadow: inset 3px 0 0 var(--pc); }
.sud-legend li.key-el b { color: var(--pc); }
.sud-legend li.key-el span { display: flex; flex-direction: column; line-height: 1.2; }
.sud-legend li.key-el strong { color: var(--chalk); font-size: 14px; }
.sud-legend li.key-el small { font-size: 11.5px; }
.sud-legend li.key-el.is-on { background: var(--pc); }
.sud-legend li.key-el.is-on b, .sud-legend li.key-el.is-on strong { color: var(--ink); }
.sud-about {
  width: min(100%, 420px);
  margin: 12px auto 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 248, 236, .08);
  color: var(--chalk);
  font-size: 14px;
  line-height: 1.45;
  min-height: 4.4em;
}
.sud-about b { color: var(--jot); }
.done-meet { margin: 14px 0 6px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.done-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.done-tile {
  width: 68px; padding: 6px 2px 7px;
  border: 0; border-radius: 10px;
  background: var(--pc); color: var(--ink);
  font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
  animation: pt-in .5s var(--spring) both;
}
.done-tile:nth-child(2) { animation-delay: 60ms; } .done-tile:nth-child(3) { animation-delay: 120ms; }
.done-tile:nth-child(4) { animation-delay: 180ms; } .done-tile:nth-child(5) { animation-delay: 240ms; }
.done-tile:nth-child(6) { animation-delay: 300ms; } .done-tile:nth-child(n+7) { animation-delay: 360ms; }
.done-tile small { font-size: 10px; opacity: .7; }
.done-tile b { font-size: 24px; line-height: 1; }
.done-tile span { font-size: 10.5px; font-weight: 700; }
