/* Circuits — page-specific styles */

.lesson { text-align: center; margin-bottom: 0.9rem; }

.lesson-name {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  color: var(--color-coral);
  margin-bottom: 0.25rem;
}

.lesson-hint {
  color: var(--color-text-muted);
  max-width: 46ch;
  margin: 0 auto;
}

/* The tray */
.tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.2rem;
  padding: 0.45rem 0.55rem;
  border: 2px solid #e8e2d8;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.tool:hover,
.tool:focus-visible { transform: translateY(-2px); border-color: var(--color-coral); outline: none; }

.tool.is-on {
  border-color: var(--color-coral);
  background: #fff;
  color: var(--color-text);
  box-shadow: 0 3px 0 rgba(255, 107, 90, 0.35);
}

/* Out of that piece: still readable, plainly not usable. */
.tool.is-empty { opacity: 0.45; }

.tool-icon { font-size: 1.25rem; line-height: 1; }

.tool-left {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--color-sky);
  color: #fff;
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The board */
.board-wrap {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 0.25rem;
}

#board {
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 10px rgba(120, 100, 70, 0.13);
  touch-action: manipulation;
  cursor: pointer;
}

#board:focus-visible { outline: 3px solid #7a5cd6; outline-offset: 3px; }

/* What the electricity is doing, in numbers */
.meter {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: 0.7rem;
  color: var(--color-text-muted);
}

.meter.is-live { color: #2f9e78; }
.meter.is-bad { color: var(--color-coral); }

/* The explanation, once it works */
.teach {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: #f2fbf7;
  border: 2px solid #bfe6d6;
}

.teach h3 {
  font-family: var(--font-display);
  color: #2f9e78;
  margin-bottom: 0.35rem;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 2px solid #e8e2d8;
  background: var(--color-bg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.chip:hover, .chip:focus-visible { border-color: var(--color-coral); outline: none; }
.chip.is-on { background: var(--color-coral); border-color: var(--color-coral); color: #fff; }
.chip.is-done { border-color: #bfe6d6; color: #2f9e78; }
.chip.is-done.is-on { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .tool { transition: none; }
}
