.jp-simon-says {
  display: grid;
  justify-items: center;
}

.jp-simon-game {
  display: grid;
  gap: var(--jp-space-4);
  width: min(100%, 560px);
}

.jp-simon-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--jp-space-3);
}

.jp-simon-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--jp-space-2);
  min-width: 0;
  padding: var(--jp-space-3);
  border: 1px solid var(--jp-border);
  border-radius: var(--jp-radius-sm);
  background: var(--jp-surface-soft);
}

.jp-simon-stat span {
  color: var(--jp-text-soft);
  font-size: var(--jp-text-xs);
  font-weight: var(--jp-weight-semibold);
  text-transform: uppercase;
}

.jp-simon-stat strong {
  color: var(--jp-text);
  font-family: var(--jp-font-mono);
  font-size: var(--jp-text-lg);
}

.jp-simon-status {
  min-height: 3em;
  margin: 0;
  color: var(--jp-text);
  font-size: var(--jp-text-sm);
  text-align: center;
}

.jp-simon-pad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--jp-space-3);
  width: min(100%, 440px);
  margin-inline: auto;
}

.jp-simon-pad {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--jp-space-2);
  min-width: 0;
  min-height: clamp(120px, 28vw, 190px);
  padding: var(--jp-space-3);
  border: 2px solid rgba(15, 23, 42, 0.16);
  border-radius: var(--jp-radius-lg);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
  opacity: 0.74;
  transition:
    opacity 0.12s ease,
    filter 0.12s ease,
    transform 0.12s ease,
    box-shadow 0.12s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.jp-simon-pad:disabled {
  cursor: default;
}

.jp-simon-pad:focus-visible {
  outline: 3px solid var(--jp-text);
  outline-offset: 3px;
}

.jp-simon-pad.is-active {
  opacity: 1;
  filter: brightness(1.35);
  transform: scale(0.98);
  box-shadow: 0 0 0 4px var(--jp-surface), 0 0 0 7px var(--jp-primary);
}

.jp-simon-pad-red {
  background: #b42332;
}

.jp-simon-pad-blue {
  background: #175cd3;
}

.jp-simon-pad-yellow {
  background: #a15c00;
}

.jp-simon-pad-green {
  background: #087443;
}

.jp-simon-pad-shape {
  font-size: clamp(1.75rem, 8vw, 3rem);
  line-height: 1;
}

.jp-simon-pad-label {
  font-size: var(--jp-text-sm);
  font-weight: var(--jp-weight-bold);
  text-align: center;
}

.jp-simon-pad-key {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  font-family: var(--jp-font-mono);
  font-size: var(--jp-text-xs);
}

.jp-simon-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--jp-space-2);
}

.jp-simon-actions .jp-tool-button {
  min-height: 44px;
}

.jp-simon-instructions {
  color: var(--jp-text-muted);
  font-size: var(--jp-text-sm);
  line-height: var(--jp-leading-relaxed);
}

.jp-simon-instructions summary {
  color: var(--jp-text);
  font-weight: var(--jp-weight-semibold);
  cursor: pointer;
}

.jp-simon-instructions ul {
  display: grid;
  gap: var(--jp-space-2);
  margin-block: var(--jp-space-3);
  padding-left: 1.25rem;
}

.jp-simon-help {
  margin-bottom: 0;
}

@media (max-width: 520px) {
  .jp-simon-game {
    padding: var(--jp-space-3);
  }

  .jp-simon-pad-grid {
    gap: var(--jp-space-2);
  }

  .jp-simon-pad {
    min-height: 128px;
    border-radius: var(--jp-radius-md);
  }

  .jp-simon-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jp-simon-actions .jp-tool-button {
    width: 100%;
    padding-inline: var(--jp-space-2);
  }
}

@media (max-width: 360px) {
  .jp-simon-hud {
    gap: var(--jp-space-2);
  }

  .jp-simon-stat {
    align-items: flex-start;
    flex-direction: column;
  }

  .jp-simon-pad {
    min-height: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jp-simon-pad {
    transition: none;
  }
}
