/* Alkuainetaulukko-peli */
.aa-setup-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}
.aa-mode-card {
  display: block;
  text-align: left;
  padding: 0.75rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s;
}
.aa-mode-card:hover {
  border-color: var(--accent);
}
.aa-mode-card.selected {
  border-color: var(--accent);
  background: rgba(74, 158, 255, 0.1);
}
.aa-mode-card strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.aa-mode-card span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.aa-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: center;
  padding: 0.65rem;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.aa-hud strong {
  font-variant-numeric: tabular-nums;
}
.aa-question {
  text-align: center;
  margin-bottom: 1rem;
}
.aa-question h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}
.aa-question .aa-symbol-hint {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0.5rem 0;
}
.aa-question .aa-sub {
  color: var(--muted);
  font-size: 0.88rem;
}
.aa-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
  max-width: 32rem;
  margin: 0 auto 1rem;
}
.aa-choice-btn {
  padding: 0.75rem 0.5rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.aa-choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
}
.aa-choice-btn.correct {
  border-color: #2d6a4f;
  background: rgba(45, 106, 79, 0.2);
}
.aa-choice-btn.wrong {
  border-color: #c44;
  background: rgba(200, 68, 68, 0.15);
}
.aa-choice-btn:disabled {
  opacity: 0.85;
  cursor: default;
}
.aa-table-wrap {
  overflow-x: auto;
  margin: 0 auto 1rem;
  padding-bottom: 0.5rem;
}
.aa-table {
  display: grid;
  grid-template-columns: repeat(18, minmax(2.1rem, 1fr));
  grid-template-rows: repeat(9, auto);
  gap: 2px;
  min-width: 36rem;
  margin: 0 auto;
}
.aa-cell {
  aspect-ratio: 1;
  min-height: 2.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.62rem;
  line-height: 1.1;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 1px;
  position: relative;
}
.aa-cell.empty {
  background: transparent;
  border: none;
  pointer-events: none;
}
.aa-cell.clickable {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.aa-cell.clickable:hover {
  transform: scale(1.08);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.aa-cell.gap {
  background: repeating-linear-gradient(45deg, #444, #444 4px, #555 4px, #555 8px) !important;
  border: 2px dashed #fff;
  animation: aa-pulse 1s ease infinite;
}
.aa-cell.correct-flash {
  box-shadow: 0 0 0 3px #2d6a4f;
}
.aa-cell.wrong-flash {
  box-shadow: 0 0 0 3px #c44;
}
@keyframes aa-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}
.aa-cell .aa-z {
  font-size: 0.5rem;
  opacity: 0.85;
}
.aa-cell .aa-sym {
  font-weight: 700;
  font-size: 0.72rem;
}
.aa-cell .aa-nm {
  font-size: 0.45rem;
  opacity: 0.9;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aa-cell.hide-name .aa-nm {
  display: none;
}
.aa-cat-alkali {
  background: #ff6b6b;
  color: #1a1a1a;
}
.aa-cat-alkaline-earth {
  background: #ffa94d;
  color: #1a1a1a;
}
.aa-cat-transition {
  background: #ffd43b;
  color: #1a1a1a;
}
.aa-cat-post-transition {
  background: #a9e34b;
  color: #1a1a1a;
}
.aa-cat-metalloid {
  background: #69db7c;
  color: #1a1a1a;
}
.aa-cat-nonmetal {
  background: #4dabf7;
  color: #fff;
}
.aa-cat-halogen {
  background: #9775fa;
  color: #fff;
}
.aa-cat-noble {
  background: #f783ac;
  color: #1a1a1a;
}
.aa-cat-lanthanide {
  background: #e599f7;
  color: #1a1a1a;
}
.aa-cat-actinide {
  background: #da77f2;
  color: #fff;
}
.aa-cat-unknown {
  background: #868e96;
  color: #fff;
}
.aa-series-label {
  grid-column: 3;
  font-size: 0.55rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.aa-feedback {
  text-align: center;
  min-height: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.aa-feedback.ok {
  color: #2d6a4f;
}
.aa-feedback.err {
  color: #c44;
}
.aa-results {
  text-align: center;
  max-width: 24rem;
  margin: 0 auto;
}
.aa-results h2 {
  margin-top: 0;
}
.aa-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  justify-content: center;
  margin: 1rem 0;
  font-size: 0.68rem;
}
.aa-legend span {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.aa-timer-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.aa-timer-bar div {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s linear;
}
@media (max-width: 520px) {
  .aa-table {
    min-width: 28rem;
  }
  .aa-cell {
    min-height: 1.75rem;
    font-size: 0.55rem;
  }
  .aa-cell .aa-sym {
    font-size: 0.62rem;
  }
}
